#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int onecount[n];
  memset(onecount, 0, sizeof(int) * n);
  for (int i = 0; i < n; i++) {
    while (arr[i] > 0) {
      onecount[i] += (arr[i] % 2);
      arr[i] /= 2;
    }
  }
  int oddcount = 0;
  int evencount = 0;
  long long ans = 0;
  int cumonecount[n];
  int cum = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (cum % 2 == 0) {
      evencount++;
    } else {
      oddcount++;
    }
    cum += onecount[i];
    cumonecount[i] = cum;
    if (cum % 2 == 0) {
      ans += evencount;
    } else {
      ans += oddcount;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int sum = 0;
    int max = 0;
    for (int j = i; j < min(n, i + 61); j++) {
      sum += onecount[j];
      if (onecount[j] > max) max = onecount[j];
      if (j > i && cumonecount[i] % 2 == (j < n - 1 ? cumonecount[j] % 2 : 0) &&
          max > (sum - max)) {
        ans--;
      }
    }
  }
  cout << ans << endl;
}
