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.
f = [0 for _ in range(2*10**3+20)]


n = int(input())
a = list(map(int, input().split()))

for x in range(10**3+2):
    f[2 * x] = f[x]
    f[2 * x + 1] = f[x] + 1
    
    
    
def find_value(x):
    
    while x > 1000:
        if x % 2 == 0:
            x = x // 2
        else:
            x -= 1
            x // 2
        
        
    return f[x]



m = [find_value(y) for y in a]

d = {}
for el in m:
    if el in d:
        d[el] += 1
    else:
        d[el] = 1

total = 0
for key in d:
    total += d[key] * (d[key] - 1) // 2
    
print(total)