#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 == 1) ++ans;
    }
  }
  ans = (n * (n - 1)) / 2 - ans;
  cout << ans;
  return 0;
}
