#include <bits/stdc++.h>
using namespace std;
long long a[300005];
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int j = 0; j < 60; j++) {
    int u = 0, v = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1LL << j))
        u++;
      else
        v++;
    }
    ans += u * v % MOD * ((1LL << j) % MOD) % MOD;
  }
  cout << ans % MOD << endl;
}
