#include <bits/stdc++.h>
using namespace std;
long long cnt[2], a[300007], ans = 0;
int n, sum = 0, b[300007], now = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = (int)(__builtin_popcountll(a[i]));
  }
  for (int i = 1; i <= n; i++) {
    now += b[i];
    now %= 2;
    int mx = 0, cur = 0;
    for (int j = i; j >= max(1, i - 63); j--) {
      cur += b[j];
      mx = max(mx, b[j]);
      if (mx * 2 <= cur && cur % 2 == 0) ans++;
    }
    if (i >= 65) ans += cnt[now];
    if (i >= 64) {
      sum += b[i - 64];
      cnt[sum % 2]++;
    }
  }
  cout << ans;
}
