#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 10;
const long long INF = 1e18 + 10;
long long n, i, j, ans, now, x, a[N], sy[N][2];
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  sy[n + 1][0] = 1;
  for (i = n; i >= 1; --i) {
    long long sum = 0, mx = 0;
    for (j = i; j <= n && j - i <= 70; ++j) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (sum % 2 == 0 && mx * 2 > sum) ans--;
    }
    now = now + a[i];
    ans += sy[i + 1][now % 2];
    sy[i][0] = sy[i + 1][0];
    sy[i][1] = sy[i + 1][1];
    sy[i][now % 2]++;
  }
  cout << ans << endl;
}
