#include <bits/stdc++.h>
long long pow_mod(long long base, long long exp, long long mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp & 1) res = res * base % mod;
    base = base * base % mod;
    exp >>= 1;
  }
  return res;
}
const int mood = 1000000007;
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> a(n);
  std::vector<std::pair<int, int>> eo(61);
  for (int i = 0; i < 61; i++) eo[i] = {0, 0};
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    for (long long j = 0; j < 60; j++) {
      if (a[i] & ((long long)1 << j))
        eo[j].first++;
      else
        eo[j].second++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 61; i++) {
    int tmp = (eo[i].first * eo[i].second) % mood;
    tmp = pow_mod(tmp, i + 1, mood);
    ans += tmp;
    ans %= mood;
  }
  std::cout << ans << std::endl;
}
