Dima got into number sequences. Now he's got sequence a1, a2, ..., an, 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 < j ≤ n) are there, such that f(ai) = f(aj). Help him, count the number of such pairs. 

Input

The first line contains integer n (1 ≤ n ≤ 105). The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

The numbers in the lines are separated by single spaces.

Output

In a single line print the answer to the problem.

Please, don't use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

3
1 2 4


Output

3


Input

3
5 3 1


Output

1

Note

In the first sample any pair (i, j) will do, so the answer is 3.

In the second sample only pair (1, 2) will do.
import java.util.*;
import java.io.*;
import java.math.*;

public class B {
    public static Scanner scan = new Scanner(System.in);
    public static boolean bg = true;

    public static void main(String[] args) throws Exception {
        int n1 = Integer.parseInt(scan.next());
        CS<Integer> cs = new CS();
        for (int i=0;i<n1;i++){
            int k1 = Integer.parseInt(scan.next());
            cs.add(calc(k1));
        }
        long fin = 0;
        for (int e: cs.m1.keySet()){
            if (cs.get(e)>=2){
                long k1 = (long)cs.get(e);
                k1 = k1*(k1-1l)/2l;
                fin += k1;
            }
        }
        System.out.println(fin);
    }
    public static BigInteger bi(long n1){
        return new BigInteger(n1+"");
    }
    public static HashMap<Integer, Integer> m1 = new HashMap();
    static {
        m1.put(0, 0);
    }
    public static int calc (int n1){
        if (m1.containsKey(n1)){
            return m1.get(n1);
        }
        if (n1%2==0){
            int fin = calc(n1/2);
            m1.put(n1, fin);
            return fin;
        }
        else {
            int fin = calc(n1/2)+1;
            m1.put(n1, fin);
            return fin;
        }
        
    }
    public static class CS<E> {
        public long total = 0;
        public HashMap<E,Integer> m1 = new HashMap();
        public void add(E k1){
            add(k1,1);
        }
        public void remove(E k1){
            add(k1,-1);
        }
        public void add(E k1, int n1){
            int nv = 0;
            if (m1.containsKey(k1)){
                nv = m1.get(k1);
            }
            m1.put(k1, nv+n1);
            total+=n1;
            if (nv+n1==0){
                m1.remove(k1);
            }
        }
        public void set(E k1, int n1){
            int nv = 0;
            if (m1.containsKey(k1)){
                nv = m1.get(k1);
            }
            m1.put(k1, n1);
            total+=n1-nv;
            if (n1==0){
                m1.remove(k1);
            }
        }
        public int get(E k1){
            if (!m1.containsKey(k1)){
                return 0;
            }
            else {
                return m1.get(k1);
            }
        }
        public String toString(){
            return m1.toString();
        }
    }
}
