#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MOD = 1e9 + 7;
const int iINF = 1e9;
int main() {
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n), bitcnt(62, 0);
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
    for (long long j = (0); j < (60); j++) {
      if (a[i] & (1LL << j)) {
        bitcnt[j]++;
      }
    }
  }
  for (long long i = (0); i < (60); i++) {
    long long notbit = n - bitcnt[i];
    long long standbit = notbit * bitcnt[i];
    ans += ((1LL << i) % MOD * standbit % MOD) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
