#include <bits/stdc++.h>
using namespace std;
int n, a[300010], b[300010], bc[2];
long long ans, x;
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) {
    scanf("%lld", &x);
    for (; x; x -= x & (-x)) ++a[i];
  }
  for (int i = (1); i <= (n); ++i) {
    b[i] = b[i - 1] + a[i];
    int t = 0, fxk = 0;
    for (int j = (i - 1); j >= (max(0, i - 128)); --j) {
      t += a[j + 1];
      fxk = max(fxk, a[j + 1]);
      if (!(t & 1) && (fxk * 2 <= t)) ++ans;
    }
    ans += bc[b[i] & 1];
    if (i >= 128) bc[b[i - 128] & 1]++;
  }
  printf("%lld\n", ans);
  return 0;
}
