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.io.*;
import java.math.BigDecimal;
import java.nio.Buffer;
import java.util.*;

public class codeforces
{


   // public static long fact[];
   // public static int mod=1000000007;
    public static long []st;
    public static int k;
    public static int[][] grid;
    public static boolean[][] visit;
    public static long n;
    public static long b;
    public static int move=0;
    public static long MOD;

    static int []a ;
    static double []ans;
    public static long badCount=0;
    public static HashSet<String> hs;
    public static void main(String[] args) throws IOException {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        int []a = new int[100];
        int []odd = new int[n];
        int []even =  new int[n];
        for (int i = 0 ; i<n;i++) {
            int k  = in.nextInt();
            a[f(k)]++;

        }
        long r = 0;
        for (int i=0;i<100;i++)
        {
            r+= (long) a[i] * (a[i] - 1) /2;
        }
        out.print(r);





        out.close();

        }
      static int f(int t)
        {
            if (t!=0) return f(t / 2) + (t % 2);
            else return 0;
        }



    public static int check(int n) {
        int m = n;
        int digit;
        int count = 0;
        while(m > 0) {
            digit = m % 10;
            m = m / 10;
            if(n % digit == 0) {
                count++;
            }
        }
        if(count >= 2) {
            return 1;
        } else {
            return 0;
        }
    }

    static boolean isPalindrome(int str[])
    {
        int l = 0;
        int h = str.length - 1;

        while (h > l)
        {
            if (str[l++] != str[h--])
            {
               return false;
            }
        }
      return true;
    }

    public static boolean isPrime(int n) {
        // Corner cases
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;

        // This is checked so that we can skip
        // middle five numbers in below loop
        if (n % 2 == 0 || n % 3 == 0)
            return false;

        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;

        return true;
    }
    public static int lcs(char []aa,char []bb , int n,int m)
    {
        int [][]l=new int[n+1][m+1];
        for (int i=0;i<=n;i++)
        {
            for (int j=0;j<=m;j++)
            {
                if(i==0 || j==0)
                {
                    l[i][j]=0;
                }else if(aa[i-1]==bb[j-1])
                {
                    l[i][j]=1+l[i-1][j-1];
                }else
                {
                    l[i][j]=Math.max(l[i-1][j],l[i][j-1]);
                }
            }
        }
        return l[n][m];

    }


    public static int bs(int []search,int target)
    {
        int low=0;
        int high=search.length-1;
        int ans=0;
        while (low<=high) {
            int mid = (low + high) >> 1;
            if (search[mid] <= target) {
                ans = mid;
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }
        return ans;

    }

   public static long ts(long start, long end)
    {
        long l = start, r = end;

        for(int i=0; i<200; i++) {
            long l1 = (l*2+r)/3;
            long l2 = (l+2*r)/3;

            if(fc(l1) > fc(l2))
                r = l2;
            else
                l = l1;
        }

       long x=l;

        return x;
    }
    public static long fc(long x) {

        return x*(n-x*b);
    }

    public static int bfs(int i,int j,int n,int m)
    {
        int troop=0;
        Queue<node> qq=new LinkedList<>();
        qq.add(new node(i,j));
        while (!qq.isEmpty())
        {
            node cur=qq.poll();
            troop++;
            for (int r=-1;r<=1;r++)
            {
                for (int c=-1;c<=1;c++)
                {
                    if(cur.x+r>=0 && cur.x+r<n && cur.y+c>=0 && cur.y+c<m)
                    {
                        if(!visit[cur.x+r][cur.y+c])
                        {
                            visit[cur.x+r][cur.y+c]=true;
                            if(grid[cur.x+r][cur.y+c]==1)
                            {
                                qq.add(new node(cur.x+r,cur.y+c));
                            }

                        }
                    }

                }
            }
        }
        return troop;


    }

    static class node{

        int x;
        int y;

        public node(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }




    public static int nextPowerOf2(final int a) {
        int b = 1;
        while (b < a) {
            b = b << 1;
        }
        return b;
    }

    public static long []contruct(long []a)

    {
        int next2power=nextPowerOf2(a.length);
        st=new long[next2power*2-1];
        //System.out.println(size);
        // st=new long[size];
        Arrays.fill(st,Integer.MAX_VALUE);
        constructST(a,0,a.length-1,0);
        return st;



    }
    public static void constructST(long []a,int start,int end,int pos)
    {
        if(start==end)
        {
            st[pos]=a[start];
            return ;
        }
        int mid=(start+end)>>1;
        constructST(a,start,mid,pos*2+1);
        constructST(a,mid+1,end,pos*2+2);
        st[pos]=st[2*pos+1]^st[2*pos+2];


    }

       static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}