#include <bits/stdc++.h>
using namespace std;
long long sum[300005], cnt0, cnt1, ans, n, a[300005], b[300005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 63; j++)
      if (a[i] & ((long long)1 << j)) b[i]++;
    sum[i] = sum[i - 1] + b[i];
    if (sum[i] % 2)
      cnt1++;
    else
      cnt0++;
  }
  long long cnt = 0;
  for (int l = 1; l <= n; l++) {
    long long Max = 0;
    for (int len = 1; len <= 63 && l + len - 1 <= n; len++) {
      int r = l + len - 1;
      if (r > n) continue;
      Max = max(Max, b[r]);
      if ((sum[r] - sum[l - 1]) % 2 == 0 && (sum[r] - sum[l - 1]) / 2 < Max)
        cnt++;
    }
  }
  cout << cnt0 * (cnt0 - 1) / 2 + cnt0 + cnt1 * (cnt1 - 1) / 2 - cnt << endl;
}
