#include <bits/stdc++.h>
using namespace std;
int n, cnt[300005], dp[300005][2];
long long temp, sum[300005];
inline int solve(long long x) {
  int ans = 0;
  while (x) {
    x -= x & -x;
    ++ans;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  sum[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &temp);
    cnt[i] = solve(temp);
    sum[i] = sum[i - 1] + cnt[i];
  }
  dp[0][0] = dp[0][1] = 0;
  for (int i = 1; i <= n; ++i) {
    if (cnt[i] & 1) {
      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];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int maxn = 0;
    for (int j = 0; j < 70; ++j) {
      if (i - j <= 0) break;
      maxn = max(maxn, cnt[i - j]);
      temp = sum[i] - sum[i - j - 1];
      if (!(temp & 1) && temp >= 2 * maxn) ++ans;
    }
    if (i - 70 > 0)
      ans += ((sum[i] - sum[i - 70]) & 1) ? dp[i - 70][1] : dp[i - 70][0];
  }
  printf("%I64d", ans);
}
