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.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {

   private Map<Integer, Integer> vals = new HashMap<>();
   int r[];

   private void solve() throws IOException {
      int n = nextInt();
      int a[] = new int[n];
      r = new int[42];
      for (int i = 0; i < n; ++i)
         a[i] = nextInt();
      vals.put(0, 0);
      long ans = 0;
      for (int i = 0; i < n; ++i) {
         int ind = f(a[i]);
         ans += r[ind];
         ++r[ind];
      }
      println(ans);
   }

   private int f(int a) {
      if (vals.containsKey(a))
         return vals.get(a);
      if (a % 2 == 0)
         vals.put(a, f(a / 2));
      else
         vals.put(a, f(a / 2) + 1);
      return vals.get(a);
   }

   public static void main(String[] args) {
      new Main().run();
   }

   public void run() {
      try {
         if (isFileIO) {
            pw = new PrintWriter(new File("output.out"));
            br = new BufferedReader(new FileReader("input.in"));
         } else {
            pw = new PrintWriter(System.out);
            br = new BufferedReader(new InputStreamReader(System.in));
         }
         solve();
         pw.close();
         br.close();
      } catch (IOException e) {
         System.err.println("IO Error");
      }
   }

   private void print(Object o) {
      pw.print(o);
   }

   private void println(Object o) {
      pw.println(o);
   }

   private void println() {
      pw.println();
   }

   int[] nextIntArray(int n) throws IOException {
      int arr[] = new int[n];
      for (int i = 0; i < n; ++i)
         arr[i] = Integer.parseInt(nextToken());
      return arr;
   }

   int nextInt() throws IOException {
      return Integer.parseInt(nextToken());
   }

   long nextLong() throws IOException {
      return Long.parseLong(nextToken());
   }

   double nextDouble() throws IOException {
      return Double.parseDouble(nextToken());
   }

   private String nextToken() throws IOException {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
         tokenizer = new StringTokenizer(br.readLine());
      }

      return tokenizer.nextToken();
   }

   private BufferedReader br;
   private StringTokenizer tokenizer;
   private PrintWriter pw;
   private final boolean isFileIO = false;
}