#include <bits/stdc++.h>
using namespace std;
long long int n, a[300005];
long long int pref[300005];
long long int cnt[2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], a[i] = __builtin_popcountll(a[i]);
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    long long int ma = a[i];
    pref[i] = a[i] + pref[i - 1];
    if (i - 70 >= 0) cnt[pref[i - 70] % 2]++;
    ans += cnt[pref[i] % 2];
    long long int sum = 0;
    for (int j = i; j >= max(1, i - 68); j--) {
      ma = max(ma, a[j]);
      sum += a[j];
      if (2 * ma <= sum && sum % 2 == 0) ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
