#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long mod2 = 998244353;
const long long INF = 1e18;
const long double EPS = 1e-10;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int keta[n][60];
  memset(keta, 0, sizeof(keta));
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (60); ++j) {
      if (a[i] % 2 == 1) keta[i][j] = 1;
      a[i] >>= 1;
    }
  }
  long long ans = 0, res = 1, com = n * (n - 1) / 2;
  for (int j = 0; j < (60); ++j) {
    long long comb = com;
    vector<long long> c(2, 0);
    for (int i = 0; i < (n); ++i) {
      c[keta[i][j]]++;
    }
    comb -= c[0] * (c[0] - 1) / 2;
    comb -= c[1] * (c[1] - 1) / 2;
    ans = (ans + res * comb) % mod;
    res = (res * 2) % mod;
  }
  cout << ans << endl;
  return 0;
}
