#include <bits/stdc++.h>
using namespace std;
int bts[300001];
int sp[2][300001];
int popCnt(long long x) {
  int rez = 0;
  while (x > 0) {
    ++rez;
    x = (x & (x - 1));
  }
  return rez;
}
int main() {
  FILE *fin = stdin;
  FILE *fout = stdout;
  int n, suma = 0;
  long long val, rez = 0LL;
  fscanf(fin, "%d", &n);
  sp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    fscanf(fin, "%lld", &val);
    bts[i] = popCnt(val);
    suma += bts[i];
    sp[0][i] = sp[0][i - 1];
    sp[1][i] = sp[1][i - 1];
    sp[suma % 2][i]++;
    int s2 = 0, mx = 0;
    for (int j = 0; j < 70; ++j) {
      if (i - j > 0) {
        s2 += bts[i - j];
        mx = max(mx, bts[i - j]);
        if (mx <= s2 / 2 && s2 % 2 == 0) ++rez;
      }
    }
    if (i - 71 >= 0) rez = rez + sp[suma % 2][i - 71];
  }
  fprintf(fout, "%lld", rez);
  return 0;
}
