#include <bits/stdc++.h>
using namespace std;
long long int get_num_one_bits(long long int num) {
  long long int ans = 0;
  while (num != 0) {
    ans += (num % 2);
    num = num / 2;
  }
  return ans;
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n + 1), b(n + 1), pref_sum(n + 1);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) b[i] = get_num_one_bits(a[i]);
  for (int i = 1; i <= n; i++) pref_sum[i] = pref_sum[i - 1] + b[i];
  vector<long long int> even_inds, odd_inds;
  even_inds.clear();
  odd_inds.clear();
  for (int i = 0; i <= n; i++) {
    if (pref_sum[i] % 2 == 0)
      even_inds.push_back(i);
    else
      odd_inds.push_back(i);
  }
  long long int ans = 0;
  vector<long long int> inds;
  for (int p = 0; p <= 1; p++) {
    if (p == 0)
      inds = even_inds;
    else
      inds = odd_inds;
    for (int l = 0; l < (long long int)inds.size() - 1; l++) {
      int j = 1;
      if (inds[l + 1] - inds[l] == 1) j++;
      while (((l + j) < inds.size()) && (inds[l + j] - inds[l] <= 64)) {
        int flag = 1;
        long long int sum = pref_sum[inds[l + j]] - pref_sum[inds[l]];
        for (int k = inds[l] + 1; k <= inds[l + j]; k++) {
          if (b[k] > sum / 2) {
            flag = 0;
            break;
          }
        }
        if (flag == 1) ans++;
        j++;
      }
      long long int curr = l + j;
      ans += (inds.size() - 1) - curr + 1;
    }
  }
  cout << ans << endl;
}
