#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, a[N], sum[2][N];
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  sum[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    a[i] += a[i - 1];
    for (int j = i - 1, cnt = 0, maxx = 0; j >= 0 && cnt < 65; --j, cnt++) {
      int cur = a[i] - a[j];
      maxx = max(maxx, a[j + 1] - a[j]);
      if (cur % 2 == 0 && cur / 2 >= maxx) ans++;
    }
    sum[0][i] = sum[0][i - 1];
    sum[1][i] = sum[1][i - 1];
    if (a[i] % 2)
      ans += (i >= 66 ? sum[1][i - 66] : 0), sum[1][i]++;
    else
      ans += (i >= 66 ? sum[0][i - 66] : 0), sum[0][i]++;
  }
  cout << ans;
  return 0;
}
