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.
D = dict()
D[0] = 0
def num(x):
    global D
    if x // 2 not in D:
        num(x // 2)
    if x % 2 == 0:    
        D[x] = D[x // 2]
    else:
        D[x] = D[x // 2] + 1
        
def main():
    n = int(input())
    line = list(map(int, input().split()))
    cou = dict()
    for i in range(n):
        if line[i] not in D:
            num(line[i])
        new = D[line[i]]
        if new not in cou:
            cou[new] = 0
        cou[new] += 1
    ans = 0
    for el in cou:
        ans += cou[el] * (cou[el] - 1) // 2
    print(ans)
main()