#include <bits/stdc++.h>
const long INF = 1e9;
const long MOD = 1e9 + 7;
using namespace std;
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<long, long>;
using vi = vc<long>;
const long MX = 777777 + 5;
long fac[MX + 5], inv[MX + 5];
long power(long x, long y, long p) {
  long res = 1;
  x = x % p;
  while (y) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void init() {
  long n = MX + 4;
  fac[0] = 1;
  for (long i = 0; i < n; ++i) fac[i + 1] = fac[i] * (i + 1) % MOD;
  inv[n] = power(fac[n], MOD - 2, MOD);
  for (long i = n - 1; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % MOD;
}
long comb(long n, long r) { return (fac[n] * inv[r]) % MOD * inv[n - r] % MOD; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  init();
  long N;
  cin >> N;
  long bkt[61];
  for (long i = long(0); i < long(61); i++) bkt[i] = 0;
  long sum = 0;
  for (long i = long(0); i < long(N); i++) {
    long a;
    cin >> a;
    sum = ((a * (N - 1)) % MOD + sum) % MOD;
    for (long j = long(0); j < long(61); j++) {
      if ((a >> j) & 1) {
        bkt[j]++;
      }
    }
  }
  for (long j = long(0); j < long(61); j++) {
    if (bkt[j] >= 2) {
      sum =
          (sum - ((2 * comb(bkt[j], 2)) % MOD * power(2, j, MOD)) % MOD) % MOD;
    }
  }
  cout << sum << endl;
}
