#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, ans, ji, ou = 1, a[300001], f[300001];
int count(unsigned int x) {
  unsigned int c = 0;
  for (c = 0; x; ++c) {
    x &= (x - 1);
  }
  return c;
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    long long k = 0;
    while (a[i]) {
      if (a[i] % 2) k++;
      a[i] >>= 1;
    }
    a[i] = k;
  }
  for (i = 1; i <= n; i++) {
    f[i] = f[i - 1] + a[i];
    if (f[i] % 2) {
      ans += ji;
      ji++;
    } else {
      ans += ou;
      ou++;
    }
  }
  for (i = 1; i <= n; i++) {
    m = 0;
    for (j = i; j <= min(i + 64, n); j++) {
      m = max(m, a[j]);
      if (m > (f[j] - f[i - 1]) / 2 && (f[j] - f[i - 1]) % 2 == 0) {
        ans--;
      }
    }
  }
  cout << ans;
}
