#include <bits/stdc++.h>
using namespace std;
long long int a[300005], dp[2][300005], one = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, i, j, ans = 0;
  cin >> n;
  for (i = 1; i <= n; ++i) {
    long long int val;
    cin >> val;
    a[i] = __builtin_popcountll(val);
  }
  for (i = 1; i <= n; ++i) {
    long long int mak = a[i], sum = a[i];
    for (j = i - 1; j >= max(one, i - 62); --j) {
      mak = max(a[j], mak);
      sum += a[j];
      if (mak <= sum - mak && sum % 2 == 0) ++ans;
    }
    if (sum % 2 == 1)
      ans += dp[1][j];
    else
      ans += dp[0][j];
    if (a[i] % 2) {
      dp[0][i] = dp[1][i - 1];
      dp[1][i] = dp[0][i - 1];
    } else {
      dp[0][i] = dp[0][i - 1];
      dp[1][i] = dp[1][i - 1];
    }
    ++dp[(a[i] % 2)][i];
  }
  cout << ans;
  return 0;
}
