#include <bits/stdc++.h>
using namespace std;
inline long long Read() {
  long long x = 0;
  char y;
  do y = getchar();
  while (y < '0' || y > '9');
  do x = x * 10 + y - '0', y = getchar();
  while (y >= '0' && y <= '9');
  return x;
}
int n, m;
int Bit[500050], Pre[500050][2];
int Get(long long x) {
  int Cnt = 0;
  while (x) {
    Cnt += x & 1;
    x >>= 1;
  }
  return Cnt;
}
long long ans;
int main() {
  n = Read();
  for (int i = 1; i <= n; i++) Bit[i] = Get(Read());
  for (int i = 1; i <= n; i++) {
    int ma = Bit[i];
    int Cnt = Bit[i];
    int le = max(i - 60, 1);
    for (int j = i - 1; j >= le; j--) {
      if (Bit[j] > ma) ma = Bit[j];
      Cnt += Bit[j];
      if (Cnt % 2 == 0 && ma <= Cnt - ma) ans++;
    }
    Pre[i][0] = Pre[i - 1][Bit[i] & 1];
    Pre[i][1] = Pre[i - 1][!(Bit[i] & 1)];
    Pre[i][Bit[i] & 1]++;
    if (le > 1) ans += Pre[le - 1][Cnt & 1];
  }
  cout << ans << endl;
  return 0;
}
