#include <bits/stdc++.h>
using namespace std;
int n, cnt[300005];
long long dp[300005][2], ans;
int main() {
  scanf("%d", &n);
  long long x;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    while (x) cnt[i] += (x & 1), x >>= 1;
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] % 2)
      dp[i][0] = dp[i - 1][1], dp[i][1] = dp[i - 1][0] + 1;
    else
      dp[i][0] = dp[i - 1][0] + 1, dp[i][1] = dp[i - 1][1];
    ans += dp[i - 1][cnt[i] % 2];
    int maxx = cnt[i], tmp = cnt[i];
    for (int j = i - 1; j >= max(i - 63, 1); j--) {
      tmp += cnt[j];
      maxx = max(maxx, cnt[j]);
      if (tmp % 2 == 0 && (maxx << 1) > tmp) ans--;
    }
  }
  printf("%lld", ans);
  return 0;
}
