#include <bits/stdc++.h>
using namespace std;
const int K = 64, N = 3e5 + 7;
int a[N];
int sum[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
    sum[i] = sum[i - 1] + a[i];
  }
  long long ans = 0;
  int odd = 0, even = 1;
  for (int i = 1; i <= n; i++) {
    if (sum[i] % 2) {
      ans += odd;
      odd++;
    } else {
      ans += even;
      even++;
    }
    int mx = 0, sm = 0;
    for (int j = 0; j < K && j < i; j++) {
      int cur = i - j;
      mx = max(mx, a[cur]);
      sm += a[cur];
      if (sm % 2 == 0 && 2 * mx > sm) ans--;
    }
  }
  cout << ans << endl;
}
