#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &item) {
  out << '(' << item.first << ", " << item.second << ')';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const auto &item : v) out << item << ' ';
  return out;
}
int v[300010], s[300010], nr[2][300010];
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, n, vmax, b;
  ll ans, a;
  cin >> n;
  nr[0][0] = 1;
  for (i = 1; i <= n; ++i) {
    cin >> a;
    v[i] = __builtin_popcountll(a);
    s[i] = s[i - 1] + v[i];
    nr[0][i] = nr[0][i - 1] + (s[i] % 2 == 0);
    nr[1][i] = nr[1][i - 1] + (s[i] % 2 == 1);
  }
  ans = 0;
  for (i = 1; i <= n; ++i) {
    for (vmax = v[i], j = i + 1; j <= i + 65 && j <= n; ++j) {
      vmax = max(vmax, v[j]);
      if (s[j] % 2 == s[i - 1] % 2 && vmax <= (s[j] - s[i - 1]) / 2) ++ans;
    }
    if (i + 66 <= n) {
      b = s[i - 1] % 2;
      ans += nr[b][n] - nr[b][i + 65];
    }
  }
  cout << ans << '\n';
  return 0;
}
