Dima got into number sequences. Now he's got sequence *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>, consisting of *n* positive integers. Also, Dima has got a function *f*(*x*), which can be defined with the following recurrence:
 -  *f*(0) = 0; -  *f*(2·*x*) = *f*(*x*); -  *f*(2·*x* + 1) = *f*(*x*) + 1. 
Dima wonders, how many pairs of indexes (*i*, *j*) (1 ≤ *i* &lt; *j* ≤ *n*) are there, such that *f*(*a*<sub class="lower-index">*i*</sub>) = *f*(*a*<sub class="lower-index">*j*</sub>). Help him, count the number of such pairs.
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>). The second line contains *n* positive integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).

The numbers in the lines are separated by single spaces.
from sys import stdin,stdout
from bisect import bisect_right as br
from bisect import bisect_left as bl
from bisect import insort_left as il
from math import gcd
def cho(n):
    return n*(n-1)//2
def val(n):
    ans=0
    while n:
        if n&1:
            ans+=1
        n//=2
    return ans
n=int(stdin.readline())
lst=[int(i) for i in stdin.readline().split()]
lst2=[]
for i in lst:
    lst2+=[val(i)]
lst2.sort()
temp=lst2[0]
c=[1]
ans=0
for i in lst2[1:]:
    if i==temp:
        c[-1]+=1
    else:
        c+=[1]
    temp=i
for i in c:
    ans+=cho(i)
stdout.write(str(ans))
