#include <bits/stdc++.h>
using namespace std;
int n;
long long x, S, sol;
int v[300005];
long long dp[300005][2];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v[i] = __builtin_popcountll(x);
  }
  dp[0][n + 1] = 1;
  for (int i = n; i >= 1; i--) {
    int mx = 0, s = 0;
    long long cnt = 0;
    for (int j = i; j <= n && j <= i + 64; j++) {
      mx = max(mx, v[j]);
      s += v[j];
      if (2 * mx > s && !(s & 1)) cnt--;
    }
    S += v[i];
    cnt += dp[S & 1][i + 1];
    sol += cnt;
    dp[0][i] = dp[0][i + 1];
    dp[1][i] = dp[1][i + 1];
    dp[S & 1][i]++;
  }
  cout << sol;
  return 0;
}
