#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
long long a[maxn];
const long long dig = 61;
long long sum[maxn];
long long cnt[maxn][2];
void solve() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    a[i] = __builtin_popcountll(a[i]);
    assert(a[i] < dig);
    assert(a[i]);
    sum[i] = (sum[i - 1] + a[i]) & 1;
  }
  for (long long i = 1; i <= n; i++) {
    long long mx = 0, sm = 0;
    for (long long j = i; j < i + dig && j <= n; j++) {
      mx = max((long long)mx, a[j]);
      sm += a[j];
      if ((sm & 1) == 0 && mx * 2 <= sm) {
        ans++;
      }
    }
  }
  cnt[0][0] = 1;
  cnt[0][1] = 0;
  for (long long i = 1; i <= n; i++) {
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    cnt[i][sum[i]]++;
  }
  for (long long i = dig + 1; i <= n; i++) ans += cnt[i - dig - 1][sum[i]];
  cout << ans;
}
signed main() {
  long long t = 1;
  while (t--) {
    solve();
  }
}
