#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int n, b[N];
long long ans = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    for (; x; x -= x & -x) b[i]++;
  }
  int c0 = 1, c1 = 0;
  long long s = 0;
  for (int i = n; i >= 1; i--) {
    int mx = 0, ts = 0;
    for (int j = i; j <= n && j <= i + 62; j++) {
      mx = max(mx, b[j]);
      ts += b[j];
      if (ts % 2 == 0 && mx > ts - mx) ans--;
    }
    s += b[i];
    ans += (s & 1) ? c1 : c0;
    ((s & 1) ? c1 : c0)++;
  }
  cout << ans << "\n";
  return 0;
}
