#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300010;
int a[MAX_N];
int sum[MAX_N];
int n;
int dp[2][64][64];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    while (x > 0) {
      if (x & 1) a[i]++;
      x >>= 1;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int e = i % 2;
    for (int j = 0; j <= 62; j++) {
      for (int p = 0; p <= 60; p++) dp[e][j][p] = 0;
    }
    for (int s = 0; s <= 62; s++) {
      int u = s + a[i];
      if (u > 60 && u % 2 == 1)
        u = 61;
      else if (u > 60)
        u = 62;
      for (int ma = 0; ma <= 60; ma++) {
        int m = max(ma, a[i]);
        dp[e][u][m] += dp[1 - e][s][ma];
      }
    }
    dp[e][a[i]][a[i]]++;
    for (int s = 2 * a[i]; s <= 62; s += 2) {
      for (int ma = a[i]; ma <= 60; ma++) ans += dp[e][s][ma];
    }
  }
  cout << ans;
}
