#include <bits/stdc++.h>
using namespace std;
const long long NN = 3e5 + 5;
long long n, a[NN], p[NN], S0[NN], S1[NN], has;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long ta;
    cin >> ta;
    a[i] = __builtin_popcountll(ta);
  }
  for (long long i = 1; i <= n; i++) {
    p[i] = (p[i - 1] + a[i]) % 2;
  }
  for (long long i = n; i >= 1; i--) {
    S0[i] = S0[i + 1];
    S1[i] = S1[i + 1];
    if (p[i] == 0)
      S0[i]++;
    else
      S1[i]++;
  }
  for (long long i = 1; i <= n; i++) {
    long long jum = 0, ma = 0;
    long long kir = min(n, i + 68);
    for (long long j = i; j <= kir; j++) {
      ma = max(ma, a[j]);
      jum += a[j];
      if (ma * 2 <= jum) {
        has += ((jum % 2) == 0);
      }
    }
    if (p[i - 1] == 1)
      has += S1[kir + 1];
    else
      has += S0[kir + 1];
  }
  cout << has << "\n";
}
