#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N], pref[N], c[N], nc[N], lst[N][61];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long c;
    cin >> c;
    a[i] = 0;
    int j = 0;
    while ((1LL << j) <= c) {
      if (c & (1LL << j)) {
        a[i]++;
      }
      j++;
    }
  }
  for (int j = 1; j <= 60; j++) {
    lst[0][j] = -1;
  }
  pref[0] = 0;
  nc[0] = 0;
  c[0] = 1;
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + a[i];
    c[i] = c[i - 1];
    nc[i] = nc[i - 1];
    if (pref[i] & 1) {
      nc[i]++;
    } else {
      c[i]++;
    }
    for (int j = 1; j <= 60; j++) {
      lst[i][j] = lst[i - 1][j];
    }
    lst[i][a[i]] = i;
  }
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    int maxpref = -1, max2 = -1;
    for (int max1 = 60; max1 > 0; max1--) {
      if (pref[i] < 2 * max1) {
        continue;
      }
      if (lst[i][max1] == -1) {
        continue;
      }
      int l = 0, r = i - 2;
      while (l != r) {
        int mid = (l + r + 1) / 2;
        if (pref[i] - pref[mid] >= 2 * max1) {
          l = mid;
        } else {
          r = mid - 1;
        }
      }
      int mid = l;
      if (mid > maxpref) {
        if (pref[i] & 1) {
          if (maxpref == -1) {
            ans += nc[mid];
          } else {
            ans += nc[mid] - nc[maxpref];
          }
        } else {
          if (maxpref == -1) {
            ans += c[mid];
          } else {
            ans += c[mid] - c[maxpref];
          }
        }
        maxpref = max(maxpref, mid);
      }
      max2 = max(max2, lst[i][max1]);
      maxpref = max(maxpref, max2);
    }
  }
  cout << ans << "\n";
  return 0;
}
