#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
long long mod_pow(long long x, long long n, long long mod) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret *= x;
      ret %= mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  vector<long long> cnt_zero(61, 0);
  vector<long long> cnt_one(61, 0);
  for (int i = 0; i < (n); ++i) {
    for (int d = 0; d < (61); ++d) {
      if ((a[i] >> d) & 1LL) {
        cnt_one[d]++;
      } else {
        cnt_zero[d]++;
      }
    }
  }
  long long ans = 0;
  for (int d = 0; d < (61); ++d) {
    ans += mod_pow(2LL, d, mod) * (cnt_zero[d] * cnt_one[d]) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
