#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long modpow(long long a, long long n, long long mod = MOD) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (int k = 0; k < (63); ++k) {
    int c0 = 0, c1 = 0;
    for (int i = 0; i < (n); ++i) {
      int x = k;
      long long y = a[i];
      while (x--) y /= 2;
      if (y % 2)
        c1++;
      else
        c0++;
    }
    long long tmp = (c0 * c1) % MOD;
    tmp = (tmp * (modpow(2, k))) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
