#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 100;
long long n, b[maxn], ans, s[2], sum;
int main() {
  scanf("%lld", &n);
  s[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    long long x;
    scanf("%lld", &x);
    b[i] = __builtin_popcountll(x);
    sum += b[i];
    ans += s[sum % 2];
    ++s[sum % 2];
  }
  for (long long i = 1; i <= n; ++i) {
    long long mx = 0;
    sum = 0;
    for (long long j = i; j <= min(n, i + 63 - 1); ++j) {
      mx = max(mx, b[j]);
      sum += b[j];
      if (sum % 2 == 0 && mx > sum - mx) --ans;
    }
  }
  printf("%lld\n", ans);
}
