#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MOD = 1e9 + 7;
signed main() {
  long long n, a;
  cin >> n;
  long long cnt[66] = {};
  for (long long i = 0; i < n; i++) {
    cin >> a;
    for (long long j = 0; j < 63; j++) {
      if ((a >> j) & 1) {
        cnt[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 63; i++) {
    ans += cnt[i] * (n - cnt[i]) * pow(2, i);
    ans %= MOD;
  }
  cout << ans << endl;
}
