#include <bits/stdc++.h>
using namespace std;
int cntBits(long long int x) {
  int ans = 0;
  while (x) {
    if (x & 1) ans++;
    x >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    arr[i] = cntBits(x);
  }
  long long int ans = 0;
  int cnt[2] = {0, 0};
  int pCarry = 0;
  int p = 0;
  for (int i = 0; i < n; ++i) {
    p ^= (arr[i] & 1);
    int nextPosition = i - 65;
    if (nextPosition >= 0) {
      cnt[pCarry]++;
      pCarry ^= (arr[nextPosition] & 1);
    }
    ans += cnt[p];
    int suma = 0;
    int maxBits = 0;
    for (int l = 0; l < 65; l++) {
      if (i - l < 0) break;
      maxBits = max(maxBits, arr[i - l]);
      suma += arr[i - l];
      if (!(suma & 1) && 2 * maxBits <= suma) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
