#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int maxn = 1e5 + 10;
const long long INF = 1e9;
const int logmaxn = 22;
int n;
long long a[maxn];
int b[maxn];
int dp[maxn];
int sum[maxn][2];
int si[maxn];
int cntbit(long long x) {
  int cnt = 0;
  for (int t = (0); t < (62); ++t) {
    if (x & (1ll << t)) ++cnt;
  }
  return cnt;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  si[0] = 0;
  for (int t = (1); t < (n + 1); ++t)
    cin >> a[t], b[t] = cntbit(a[t]), si[t] = si[t - 1] + b[t];
  sum[0][0] = 1, sum[0][1] = 0;
  for (int t = (1); t < (n + 1); ++t) {
    for (int i = (0); i < (2); ++i) sum[t][i] = sum[t - 1][i];
    ++sum[t][si[t] % 2];
  }
  memset(dp, 0, sizeof(dp));
  for (int i = (1); i < (n + 1); ++i) {
    int cntbit = 0;
    for (int j = i - 1; j >= i - 62 && j; --j) {
      cntbit += b[j];
      if (cntbit >= b[i] && (cntbit + b[i]) % 2 == 0) ++dp[i];
    }
    if (i - 64 >= 0) dp[i] += sum[i - 64][si[i] % 2];
  }
  long long ans = 0;
  for (int t = (1); t < (n + 1); ++t) ans += dp[t];
  cout << ans;
}
