#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
using vc = vector<char>;
using vvc = vector<vc>;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
long long modpow(long long a, long long n, long long 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;
  vll a(n);
  vll b1(60);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
    bitset<60> g(a[i]);
    for (long long j = 0; j < (60); j++) {
      if (g.test(j)) {
        b1[j]++;
      }
    }
  }
  sort((a).rbegin(), (a).rend());
  long long ans = 0;
  for (long long i = 0; i < (n - 1); i++) {
    bitset<60> g(a[i]);
    long long cu = 59;
    while (1) {
      if (g.test(cu)) break;
      cu--;
    }
    long long s = modpow(2, cu, MOD);
    for (int j = cu; j >= 0; j--) {
      if (g.test(j)) {
        ans += s * (n - i - b1[j]);
        s /= 2;
        b1[j]--;
        ans %= MOD;
      } else {
        ans += s * (b1[j]);
        s /= 2;
        ans %= MOD;
      }
    }
  }
  cout << (ans) << endl;
}
