#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
long long A[N], B[N];
long long tot = 0;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    A[i] = __builtin_popcountll(A[i]);
    B[i] = B[i - 1] ^ (A[i] & 1);
  }
  for (int j = 0; j < 2; j++) {
    long long cnt = 0;
    if (j == 0) cnt++;
    for (int i = 1; i <= n; i++) {
      if (B[i] == j) cnt++;
    }
    tot += cnt * (cnt - 1) / 2;
  }
  for (int i = 1; i <= n; i++) {
    long long Mx = 0, cnt = 0;
    for (int j = i; j <= min(n, i + 65); j++) {
      cnt += A[j];
      Mx = max(Mx, A[j]);
      if (cnt % 2 == 0 && Mx > cnt - Mx) tot--;
    }
  }
  cout << tot;
  return 0;
}
