#include <bits/stdc++.h>
using namespace std;
long long n, ans = 0;
long long a[300005], pre[300005], precnt[300005][2], dp[300005][2];
long long query(long long l, long long r, long long x) {
  if (l > r) return 0;
  return precnt[r][x] - precnt[l - 1][x];
}
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, cnt = 0;
    cin >> x;
    while (x) cnt += (x & 1ll), x >>= 1ll;
    a[i] = cnt;
  }
  for (long long i = 1; i <= n; i++) pre[i] = (pre[i - 1] + a[i]) & 1ll;
  precnt[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < 2; j++) precnt[i][j] = precnt[i - 1][j];
    precnt[i][pre[i]]++;
  }
  for (long long i = 1; i <= n; i++) {
    long long maxv = a[i], sumv = a[i];
    for (long long j = i + 1; j <= min(i + 80, n); j++) {
      sumv += a[j];
      maxv = max(maxv, a[j]);
      if (sumv % 2 == 0 && maxv <= sumv / 2) ans++;
    }
    long long x = pre[i - 1] & 1;
    ans += query(i + 81, n, x);
  }
  cout << ans << endl;
  return 0;
}
