#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1 << 62;
const long long MOD = 1e9 + 7;
const int iINF = 1 << 30;
const double PI = 3.14159265359;
int setbits(long long n) {
  int cnt = 0;
  for (int bit = 61; bit >= 0; bit--) {
    if ((1ll << bit & n)) cnt++;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    b[i] = setbits(x);
  }
  int evenc = 1, oddc = 0;
  int currsum = 0;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    currsum += b[i];
    if (currsum % 2)
      ans += oddc;
    else
      ans += evenc;
    if (currsum % 2)
      oddc++;
    else
      evenc++;
  }
  for (int i = 0; i < n; i++) {
    currsum = 0;
    int maxi = 0;
    for (int j = i; j < min(n, i + 62); j++) {
      currsum += b[j];
      maxi = max(maxi, b[j]);
      if (currsum % 2 == 0 && 2 * maxi > currsum) ans--;
    }
  }
  cout << ans << "\n";
  return 0;
}
