#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> bt(65, 0);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (int j = 0; j <= 60; j++) {
      if ((x & (1ll << j))) {
        bt[j]++;
      }
    }
  }
  for (int j = 0; j <= 60; j++) {
    long long tmp = (bt[j] * (n - bt[j])) % MOD;
    tmp = (tmp * (1ll << j) % MOD) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans;
}
