#include <bits/stdc++.h>
using namespace std;
long long n;
const long long N = 3e5 + 43;
long long a[N];
long long pref[N][2];
inline void input() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
  }
  pref[0][0] = 1;
  long long sum = 0;
  for (long long i = 1; i <= n; ++i) {
    sum += a[i];
    pref[i][0] = pref[i - 1][0];
    pref[i][1] = pref[i - 1][1];
    pref[i][sum % 2]++;
  }
}
void solve() {
  long long ans = 0;
  long long sum = 0;
  for (long long i = 1; i <= n; ++i) {
    sum += a[i];
    ans += pref[i - 1][sum % 2];
  }
  for (long long L = 1; L <= n; ++L) {
    long long sum = a[L], maxx = a[L];
    for (long long R = L; R <= min(n, L + 61); ++R) {
      sum += a[R];
      maxx = max(a[R], maxx);
      if (maxx * 2 > sum) --ans;
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  solve();
  return 0;
}
