#include <bits/stdc++.h>
template <typename T>
T gcd(T a, T b) {
  return ((a % b == 0) ? b : gcd(b, a % b));
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;
namespace Problem {
using namespace std;
class Solver {
 public:
  int n;
  vector<LL> a;
  vector<LL> b;
  Solver(LL n) : n(n), a(n + 1), b(n + 1){};
  int cnt(LL x) {
    int ret = 0;
    for (int i = 0; i < 63; ++i) {
      if ((x >> i) & 1) ret++;
    }
    return ret;
  }
  void solve() {
    for (int i = 0; i < n; ++i) {
      cin >> a[i + 1];
    }
    for (int i = 0; i <= n; ++i) {
      b[i] = cnt(a[i]);
      a[i] = cnt(a[i]);
    }
    LL ans = 0;
    for (int i = 1; i <= n; ++i) {
      b[i] += b[i - 1];
    }
    vector<vector<LL>> cnt(n + 1, vector<LL>(2));
    for (int i = 0; i <= n; ++i) {
      cnt[i][b[i] % 2]++;
    }
    for (int i = 1; i <= n; ++i) {
      cnt[i][0] += cnt[i - 1][0];
      cnt[i][1] += cnt[i - 1][1];
    }
    for (int i = 1; i <= n; ++i) {
      LL ma = a[i];
      int j = i;
      for (; j <= min(i + 70, n); j++) {
        ma = max(ma, a[j]);
        if ((b[j] - b[i - 1]) % 2 == 0 && (b[j] - b[i - 1]) >= 2 * ma) {
          ans++;
        }
      }
      int d = b[i - 1] % 2;
      ans += (cnt[n][d] - cnt[j - 1][d]);
    }
    cout << ans << endl;
  }
};
}  // namespace Problem
int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  long long n = 0;
  std::cin >> n;
  Problem::Solver sol(n);
  sol.solve();
  return 0;
}
