#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int mod = 1e9 + 7;
const long long inf = 1e14;
const int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[8] = {1, 0, -1, 0, -1, 1, 1, -1};
long long a[maxn], b[maxn], pr[maxn], ans, mx;
int n;
int main() {
  cin >> n;
  long long x;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    a[i] = __builtin_popcountll(x * 1ll);
    pr[i] = a[i] + pr[i - 1];
    b[i] = b[i - 1] + (pr[i] & 1);
  }
  for (int i = 1; i <= n; ++i) {
    mx = a[i];
    if (pr[i - 1] & 1)
      ans += b[n] - b[i];
    else
      ans += (n - b[n]) - (i - b[i]);
    for (int j = i + 1; j <= min(i + 61, n); ++j) {
      mx = max(mx, a[j]);
      if ((pr[j] - pr[i - 1]) % 2 == 0 && (pr[j] - pr[i - 1]) < mx * 2) ans--;
    }
  }
  cout << ans;
  return 0;
}
