#include <bits/stdc++.h>
using namespace std;
long long n;
long long first(long long n1) {
  long long ff = 0;
  while (n1 > 0) {
    ff += (n1 % 2);
    n1 /= 2;
  }
  return ff;
}
int main() {
  cin >> n;
  vector<long long> a(n, 0), b(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = first(a[i]);
  }
  long long e = 0, s0 = 1, s1 = 0;
  for (long long i = n - 1; i >= 0; i--) {
    b[i] = b[i + 1] + a[i];
    if (b[i] % 2 == 0)
      e += s0;
    else
      e += s1;
    if (b[i] % 2 == 0)
      s0++;
    else {
      s1++;
    }
  }
  for (long long i = 0; i < n; i++) {
    long long mx = -1, sum = 0;
    for (long long j = i; j <= min(i + 61, n - 1); j++) {
      mx = max(mx, a[j]);
      sum += a[j];
      if ((mx * 2 > sum) && sum % 2 == 0) e--;
    }
  }
  cout << e;
}
