#include <bits/stdc++.h>
using namespace std;
const int maxN = 300001;
int A[maxN], cnt[2];
int main() {
  int n, par = 0;
  scanf("%d", &n);
  cnt[0] = 1;
  long long res = 0;
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    long long a;
    scanf("%lld", &a);
    A[i] = __builtin_popcountll((a));
    par ^= A[i] & 1;
    res += cnt[par];
    cnt[par]++;
  }
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    int s = 0, p = 0, m = 0;
    for (int(j) = (i); (j) < (min(i + 60, n + 1)); (j)++) {
      p ^= A[j] & 1, m = max(m, A[j]), s += A[j];
      ;
      if (p == 0 and s - m < m) res--;
    }
  }
  printf("%lld\n", res);
  return 0;
}
