#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 10;
long long a[N];
long long mp[3];
long long b[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  mp[0] = 1;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    b[i] = b[i - 1] + a[i];
    b[i] %= 2;
    ans += mp[b[i]];
    mp[b[i]]++;
  }
  long long ans1 = 0;
  for (long long i = 1; i <= n; i++) {
    long long mx = 0;
    long long sum = 0;
    for (long long j = i; j <= min(n, i + 64); j++) {
      mx = max(mx, a[j]);
      sum += a[j];
      if (sum < 2 * mx && (b[j] - b[i - 1]) % 2 == 0) ans--;
    }
  }
  cout << ans << "\n";
}
