#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> cnt(n + 1);
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    while (x) {
      cnt[i] += x & 1;
      x >>= 1;
    }
  }
  vector<int> pre(n + 1);
  for (int i = 1; i <= n; i++) pre[i] += pre[i - 1] + cnt[i];
  vector<int> oe(2, 0);
  vector<bool> id(2, 0);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    id[0] = pre[i] & 1;
    ans += oe[id[0]] + (id[0] ^ 1);
    oe[id[0]]++;
    ans -= (id[0] == id[1]);
    id[1] = id[0];
  }
  for (int i = 1; i <= n; i++) {
    long long sum = cnt[i];
    int mx = cnt[i];
    for (int j = i - 1; j >= 1 && j >= i - 61; j--) {
      sum += cnt[j];
      mx = max(mx, cnt[j]);
      if (mx > sum - mx && (sum & 1) == 0) ans--;
    }
  }
  cout << ans << '\n';
  return 0;
}
