#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long ans = 0;
  int64_t a[n];
  int64_t ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ma = max(ma, a[i]);
  }
  int64_t im = 1;
  int64_t imc = 1;
  while (ma >= im) {
    im *= 2;
    imc++;
  }
  for (int i = 0; i < imc; i++) {
    long long t = 0, f = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (long long)(1 << i))
        t++;
      else
        f++;
    }
    long long po = 1;
    for (int j = 0; j < i; j++) po = (po * 2) % mod;
    ans = ans + (po * ((t * f) % mod) % mod) % mod;
  }
  cout << ans << endl;
}
