#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long res = 0;
  for (int bit = 0; bit < 64; bit++) {
    long long cnt = 0;
    long long t = 1LL << bit;
    for (int i = 0; i < n; i++) {
      if (a[i] & t) cnt++;
    }
    res += (cnt * (n - cnt) * t) % MOD;
    res %= MOD;
  }
  cout << res << endl;
}
