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;
bool secdes(const pair<long long int, long long int>& a,
            const pair<long long int, long long int>& b) {
  if (a.second == b.second) {
    return a.first > b.first;
  } else {
    return a.second > b.second;
  }
}
bool sir(const pair<long long int, long long int>& a,
         const pair<long long int, long long int>& b) {
  if (a.first == b.first) {
    return a.second > b.second;
  } else {
    return a.first > b.first;
  }
}
bool bysec(const pair<long long int, long long int>& a,
           const pair<long long int, long long int>& b) {
  if (a.second == b.second) {
    return a.first < b.first;
  } else {
    return a.second < b.second;
  }
}
const long long int no = 1e6 + 1;
const long long int modulo = 1e9 + 7;
const long long int inf = 1e18;
const long long int N = 2001;
long long int ar[no], br[no], mat[N][N];
long long int dx[] = {-1, 0, 1, 0};
long long int dy[] = {0, 1, 0, -1};
char dc[] = {'L', 'D', 'R', 'U'};
long long int mul(long long int x, long long int y, long long int mod) {
  return ((x % mod) * (y % mod)) % mod;
}
long long int powwmod(long long int x, long long int y, long long int mod) {
  long long int res = 1;
  while (y) {
    if (y & 1) {
      y--;
      res = mul(res, x, mod);
      res %= mod;
    } else {
      y /= 2;
      x = mul(x, x, mod);
      x %= mod;
    }
  }
  return res % mod;
}
long long int poww(long long int x, long long int y) {
  long long int res = 1;
  while (y) {
    if (y % 2) {
      y--;
      res = res * x;
    } else {
      y /= 2;
      x = x * x;
    }
  }
  return res;
}
long long int div(long long int x, long long int y, long long int mod) {
  return x * poww(y, mod - 2) % mod;
}
bool comp(long long int x, long long int y) {
  return (x < y);
  return (x > y);
}
long long int gcd(long long int x, long long int y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long int lcm(long long int x, long long int y) {
  return (x * y) / gcd(x, y);
}
vector<long long int> adj[no];
long long int used[no];
void solve() {
  long long int n = 0, m = 0, a = 0, b = 0, x = 0, y = 0, z = 0, w = 0, k = 0;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
    ar[i] = __builtin_popcount(ar[i]);
  }
  sort(ar, ar + n);
  for (long long int i = 0; i < n - 1; i++) {
    if (ar[i] == ar[i + 1])
      x++;
    else
      y += (x * (x + 1)) / 2, x = 0;
  }
  cout << y + (x * (x + 1)) / 2 << "\n";
}
inline void runn() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
}
