#include <bits/stdc++.h>
using namespace std;
vector<long long> a, pre, ev;
vector<vector<long long>> nxt;
long long n;
int32_t main() {
  cin >> n;
  a.resize(n);
  pre.assign(n + 1, 0);
  ev.assign(2, 0);
  ev[0] = 1;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
    pre[i + 1] = pre[i] + a[i];
    ev[pre[i + 1] % 2]++;
  }
  nxt.resize(n, vector<long long>(64, n));
  auto c2 = [&](long long x) { return x * (x - 1) / 2; };
  long long cnt = c2(ev[1]) + c2(ev[0]);
  for (long long l = 0; l < n; ++l) {
    long long su = 0, mx = 0;
    for (long long r = l; r < min(n, l + 70); ++r) {
      su += a[r];
      mx = max(mx, a[r]);
      if (su < 2LL * mx && su % 2 == 0) cnt--;
    }
  }
  cout << cnt << endl;
  return 0;
}
