Awk sort and unique

Input file
---------

12:name1:|host1|host1|host2|host1
13:name2:|host1|host1|host2|host3
14:name3:
......

Required output
---------------

12:name1:host1(2)|host1(1)
13:name2:host1(2)|host2(1)|host3(1)
14:name3:

where (x) - Count how many times field appears in last column

Thanks

nawk -F: -f grey.awk myFile

grey.awk:

{
  n=split($NF,t,"|")
  split("",a)
  for(i=2;i<=n;i++)
    a[t]++
  printf("%s%c%s%c", $1, FS,$2,FS)
  for(i in a)
     printf("%s(%d)|", i, a)
  print ""
}
echo "12:name1:|host1|host1|host2|host1
13:name2:|host1|host1|host2|host3" |
awk -v FS="|" '{for(i=2;i<=NF;i++) {a[NR,$i" "NR]=++b[$i" "NR];c[NR]=$1}}END{{for(m=1;m<=NR;m++) {printf c[m]; for(n in b) if(a[m,n])printf FS n "("a[m,n]")";print ""}}}'
12:name1:|host1 1(3)|host2 1(1)
13:name2:|host2 2(1)|host3 2(1)|host1 2(2)

thanks guys , both solutions worked fine