#include <bits/stdc++.h>
using namespace std;
class Mod {
 public:
  vector<long long> fac;
  vector<long long> finv;
  vector<long long> inv;
  long long MOD;
  Mod(long long MAX = 1e6, long long mod = 1e9 + 7) {
    MOD = mod;
    fac.resize(MAX + 2);
    finv.resize(MAX + 2);
    inv.resize(MAX + 2);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < MAX; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
  }
  long long com(long long n, long long k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  long long add(long long a, long long b) { return (a + b) % MOD; }
  long long mul(long long a, long long b) { return (a * b) % MOD; }
  long long modinv(long long a) {
    long long b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
  }
  long long div(long long a, long long b) { return (a * modinv(b) % MOD); }
};
signed main(void) {
  Mod M;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.rbegin(), a.rend());
  long long max_a = 60;
  vector<long long> one(max_a, 0), zero(max_a, 0);
  for (long long i = 0; i < max_a; i++) {
    for (long long j = 0; j < n; j++) {
      if (((a[j] >> i) & 1) == 1) {
        one[i]++;
      } else {
        zero[i]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < max_a; i++) {
    ans = M.add(ans, M.mul(M.mul(zero[i], one[i]), pow(2, i)));
  }
  cout << ans << endl;
  return 0;
}
