#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 3e5 + 5;
const long long int mod = 1e9 + 7;
const long long int inf = 1e9 + 9;
long long int o[N], e[N], pre[N], a[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int ans = 0;
  e[0]++;
  for (long long int i = 1; i <= n; i++) {
    long long int p;
    cin >> p;
    a[i] = __builtin_popcountll(p);
    long long int s = a[i], mx = a[i];
    pre[i] = pre[i - 1] + a[i];
    long long int z = max(i - 65LL, 0LL);
    for (long long int j = i - 1; j >= z; j--) {
      if (s % 2 == 0 && mx <= s - mx) ans++;
      s += a[j];
      mx = max(mx, a[j]);
    }
    e[i] = e[i - 1];
    o[i] = o[i - 1];
    if (pre[i] & 1)
      o[i]++;
    else
      e[i]++;
    if (z == 0) continue;
    if (pre[i] & 1)
      ans += o[z - 1];
    else
      ans += e[z - 1];
  }
  cout << ans;
  return 0;
}
