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.
#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
string sing(char x) {
  string s(1, x);
  return s;
}
bool cmpDec(long long int a, long long int b) {
  if (a >= b) return true;
  return false;
}
void print1D(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void print2D(long long int **dp, long long int n, long long int m) {
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cout << dp[i][j] << " ";
    cout << "\n";
  }
}
void init1D(long long int *a, long long int n, long long int k) {
  for (long long int z = 0; z < n; z++) a[z] = k;
}
void init2D(long long int **a, long long int n, long long int m,
            long long int k) {
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < m; j++) a[i][j] = k;
}
long long int fastmod(long long int base, long long int exp, long long int m) {
  long long int res = 1;
  while (exp) {
    if (exp & 1ll) res = (res * base) % m;
    base = (base * base) % m;
    exp /= 2;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int logBase(long long int m, long long int b) {
  long long int count = 0;
  while (m > 1) {
    ++count;
    m = m / b;
  }
  return count;
}
long long int spf[100000 + 1];
void sieve() {
  spf[1] = 1;
  for (long long int i = 2; i < 100000 + 1; i++) spf[i] = i;
  for (long long int i = 4; i < 100000 + 1; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < 100000 + 1; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < 100000 + 1; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<long long int> getFactorization(long long int x) {
  vector<long long int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
long long int sumofFactors(long long int n) {
  long long int res = 1;
  for (long long int i = 2; i <= sqrt(n); i++) {
    long long int curr_sum = 1;
    long long int curr_term = 1;
    while (n % i == 0) {
      n = n / i;
      curr_term *= i;
      curr_sum += curr_term;
    }
    res *= curr_sum;
  }
  if (n >= 2) res *= (1 + n);
  return res;
}
void SUM(long long int *a, long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) sum += a[i];
  cout << sum << "\n";
}
void addEdge(vector<long long int> adj[], long long int u, long long int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void printGraph(vector<long long int> adj[], long long int V) {
  for (long long int v = 1; v < V; ++v) {
    cout << "\n Adjacency list of vertex " << v << "\n head (" << v << ")";
    for (long long int x = 0; x < adj[v].size(); x++)
      cout << " -> " << adj[v][x];
    printf("\n");
  }
}
bool cycle(vector<long long int> adj[], long long int vis[], long long int n,
           long long int parent) {
  vis[n] = 1;
  if (adj[n].empty()) return false;
  bool value = false;
  for (long long int i = 0; i < adj[n].size(); i++) {
    if (adj[n][i] != parent) {
      if (vis[adj[n][i]] == 1)
        return true;
      else
        value |= cycle(adj, vis, adj[n][i], n);
    }
  }
  return value;
}
typedef struct num {
  long long int index;
  long long int value;
} num;
long long int countFactors(long long int n) {
  long long int count = 0;
  long long int ans = 1;
  for (long long int i = 2; i < sqrt(n) + 1; i++) {
    count = 0;
    while (n % i == 0) {
      n /= i;
      ++count;
    }
    ans *= count;
  }
  if (n > 1) ans *= 2;
  return ans;
}
long long int kthFactor(long long int n, long long int k) {
  vector<long long int> v;
  for (long long int i = 2; i < (long long int)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i < n / i) v.push_back(n / i);
    }
  }
  v.push_back(1);
  v.push_back(n);
  sort(v.begin(), v.end());
  if (v.size() < k) return -1;
  return v[k - 1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int *a;
  a = new long long int[n];
  long long int count[31];
  init1D(count, 31, 0);
  for (long long int z = 0; z < n; z++) cin >> a[z];
  long long int val = 0;
  for (long long int i = 0; i < n; i++) {
    val = 0;
    while (a[i] > 0) {
      if (a[i] % 2) ++val;
      a[i] /= 2;
    }
    count[val]++;
  }
  long long int ans = 0;
  for (long long int i = 0; i < 31; i++) {
    ans += (count[i] * (count[i] - 1)) / 2;
  }
  cout << ans << "\n";
}
