import Data.List
main=do
 n<-getLine
 a<-map(read::String->Int).words<$>getLine
 let ai=sort$zip a[1..]
 let as=map fst$ai
 let g=map(\a->(head a,length a))$group$as
 let ans=sum$map(\(k,v)->v*(v-1)`div`2)$g
 let x=f ans as g
 putStr$unlines$map(show.snd)$sort$map(\(a,(b,c))->(c,a))$zip x$ai
f ans[]g=[]
f ans(a:as)ag@((k,v):g)
 |a==k=ans-v+1:f ans as ag
 |otherwise=f ans(a:as)g