#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int N = 300001;
const int oo = 1e9;
int n;
long long a[N], pre[N], re, ro;
int cnt(long long u) {
  int res = 0;
  while (u) {
    res += u % 2;
    u /= 2;
  }
  return res;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    a[i] = cnt(a[i]);
    pre[i] = a[i] + pre[i - 1];
  }
  long long res = 0;
  for (int i = 0; i <= n; ++i) {
    res += pre[i] % 2 ? ro : re;
    if (pre[i] % 2)
      ro++;
    else
      re++;
  }
  for (int i = 1; i <= n; ++i) {
    int mx = 0, sum = 0;
    for (int j = i; j <= min(i + 62, n); ++j) {
      mx = max(mx, (int)a[j]);
      sum += a[j];
      if (mx > sum - mx && sum % 2 == 0) {
        res--;
      }
    }
  }
  cout << res << endl;
  return 0;
}
