#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>;
int main() {
  long long n;
  cin >> n;
  vll a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  vll b(60, 0);
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (60); j++) {
      if (a[i] & (1LL << j)) {
        b[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (60); i++) {
    if (b[i] == n || b[i] == 0) continue;
    ans += (b[i] % MOD * ((n - b[i]) % MOD)) % MOD * ((1 << i) % MOD);
    ans %= MOD;
  }
  cout << (ans) << endl;
}
