#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const long long MOD = 1e9 + 7;
long long a[N];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long res = 0;
    for (int i = 0; i < 60; i++) {
      long long w = 1ll << i;
      long long cnt0 = 0, cnt1 = 0;
      for (int j = 1; j <= n; j++) {
        if (1ll << i & a[j])
          cnt1++;
        else
          cnt0++;
      }
      res = (res + w * cnt0 % MOD * cnt1 % MOD) % MOD;
    }
    cout << res << endl;
  }
  return 0;
}
