#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
const long long Mod = 1000000007;
long long a[maxn];
long long s1[maxn], s0[maxn], s[maxn];
long long count(long long x) {
  long long ans = 0;
  while (x) {
    if (x & 1) ans++;
    x >>= 1;
  }
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  int n;
  cin >> n;
  long long x;
  int j;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i] = count(x);
  }
  for (int i = 1; i <= n; i++) {
    s[i] = s[i - 1] + a[i];
    s0[i] = s0[i - 1];
    s1[i] = s1[i - 1];
    if (s[i] % 2 == 0) {
      s0[i]++;
    } else {
      s1[i]++;
    }
  }
  long long pre, pos;
  long long ans = 0, r, mx;
  for (int i = 1; i <= n; i++) {
    pre = a[i];
    mx = a[i];
    for (j = i + 1; j <= n; j++) {
      pre += a[j];
      mx = max(a[j], mx);
      if (pre % 2ll == 0 && 2ll * mx <= pre) ans++;
      if (pre >= 130) {
        if (pre % 2ll == 0) {
          if (s[j] % 2 == 0)
            ans += 1ll * (s0[n] - s0[j]);
          else
            ans += 1ll * (s1[n] - s1[j]);
        } else {
          if (s[j] % 2 == 1)
            ans += 1ll * (s0[n] - s0[j]);
          else
            ans += 1ll * (s1[n] - s1[j]);
        }
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
