#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> 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++) {
    ans = (ans + ((1ll << j) * bt[j] * (n - bt[j])) % MOD) % MOD;
  }
  cout << ans;
}
