#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6;
int N;
int a[MAXN];
int pre_sum_par[MAXN][2];
int pre_par[MAXN];
int pre_sum[MAXN];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    long long x;
    scanf("%lld", &x);
    a[i] = __builtin_popcountll(x);
  }
  long long ans = 0;
  pre_sum_par[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    pre_par[i] = pre_par[i - 1] ^ (a[i] & 1);
    pre_sum[i] = pre_sum[i - 1] + a[i];
    pre_sum_par[i][0] = pre_sum_par[i - 1][0];
    pre_sum_par[i][1] = pre_sum_par[i - 1][1];
    pre_sum_par[i][pre_par[i]]++;
    int st = max(i - 64, 1);
    int maxv = 0;
    for (int j = i; j >= st; j--) {
      maxv = max(maxv, a[j]);
      if ((pre_par[j - 1] ^ pre_par[i]) == 0 &&
          pre_sum[i] - pre_sum[j - 1] >= 2 * maxv) {
        ans++;
      }
    }
    if (st > 1) {
      ans += pre_sum_par[st - 2][pre_par[i]];
    }
  }
  printf("%lld\n", ans);
}
