#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
long long n;
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  long long a[n + 1];
  for (long long i = (1); i <= (n); i++) {
    cin >> a[i];
  }
  long long cnt[70];
  memset(cnt, 0, sizeof(cnt));
  for (long long i = (1); i <= (n); i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & (1LL << j)) {
        cnt[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = (1); i <= (n); i++) {
    for (long long j = 0; j < 60; j++) {
      if (cnt[j] > 0) {
        long long flag = (1LL << j);
        flag %= MOD;
        if (a[i] & (1LL << j)) {
          long long buf = (n - cnt[j]) * flag;
          buf %= MOD;
          ans += buf;
          ans %= MOD;
        } else {
          long long buf = cnt[j] * flag;
          buf %= MOD;
          ans += buf;
          ans %= MOD;
        }
      }
    }
  }
  cout << (ans / 2) << endl;
  return 0;
}
