#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18;
const int inf = 1001001001;
const long long mod = 1e9 + 7;
const int nax = 3e5 + 7;
int n, msb = 0;
int s[nax], c1[65], c0[65];
void coint(int a) {
  for (int i = 0; i < msb; ++i) {
    if (a & (1 << i))
      c1[i]++;
    else
      c0[i]++;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    msb = max(msb, 32 - __builtin_clz(s[i]));
  }
  for (int i = 0; i < n; ++i) coint(s[i]);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < msb; ++j) {
      if (s[i] & (1 << j)) {
        for (int l = 0; l < c0[j]; ++l)
          ans = (ans + ((long long)(1 << j) % mod)) % mod;
      }
    }
  }
  cout << ans;
  return 0;
}
