#include <bits/stdc++.h>
using namespace std;
const int M = 3e5 + 5;
long long a[M], b[M], f[2], res;
int n;
int cal(long long x) {
  int cnt = 0;
  while (x) {
    cnt += (x & 1);
    x >>= 1;
  }
  return cnt;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = cal(a[i]);
  }
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    b[i] += b[i - 1];
    res += f[b[i] & 1];
    long long mx = b[i] - b[i - 1];
    for (int j = i; j >= 1 && j >= i - 62; j--) {
      mx = max(mx, b[j] - b[j - 1]);
      if (mx > b[i] - b[j - 1] - mx && (b[i] & 1) == (b[j - 1] & 1)) {
        res--;
      }
    }
    f[b[i] & 1]++;
  }
  cout << res << endl;
  return 0;
}
