#include <bits/stdc++.h>
using namespace std;
const int MAX_BIT = 60;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), prefixSum(n);
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
    prefixSum[i] = a[i];
    if (i) prefixSum[i] += prefixSum[i - 1];
  }
  vector<int> evenSums(n);
  for (int i = 0; i < n; ++i) {
    if (i) evenSums[i] = evenSums[i - 1];
    if (!(prefixSum[i] & 1)) ++evenSums[i];
  }
  long long ans = 0;
  int nextOccurrence[MAX_BIT];
  for (int i = 0; i < MAX_BIT; ++i) nextOccurrence[i] = n;
  for (int i = n - 1; i >= 0; --i) {
    int sumBefore = (i ? prefixSum[i - 1] : 0);
    nextOccurrence[a[i]] = i;
    int minBigBitOccurrence = n;
    for (int bit = MAX_BIT - 1; bit >= 0; --bit) {
      int left = nextOccurrence[bit] - 1, right = n;
      while (right - left > 1) {
        int mid = (left + right) / 2;
        if (prefixSum[mid] - sumBefore >= 2 * bit)
          right = mid;
        else
          left = mid;
      }
      int minRangeEnd = right;
      int maxRangeEnd;
      if (bit == MAX_BIT - 1)
        maxRangeEnd = n - 1;
      else
        maxRangeEnd = minBigBitOccurrence - 1;
      minBigBitOccurrence = min(minBigBitOccurrence, nextOccurrence[bit]);
      if (minRangeEnd > maxRangeEnd) continue;
      int cnt = ans;
      if (sumBefore & 1)
        ans += (maxRangeEnd + 1 - evenSums[maxRangeEnd]) -
               (minRangeEnd - evenSums[minRangeEnd - 1]);
      else
        ans += evenSums[maxRangeEnd] - evenSums[minRangeEnd - 1];
    }
  }
  cout << ans << endl;
  return 0;
}
