#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const long long LINF = 1e18 + 100;
const int MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  int N;
  cin >> N;
  vector<long long> c(N);
  for (int i = 0; i < (N); i++) {
    cin >> c[i];
  }
  long long ans = 0;
  for (int i = 0; i < (61); i++) {
    int n0 = 0;
    int n1 = 0;
    for (int j = 0; j < (N); j++) {
      if (c[j] & (1ll << i)) {
        n1++;
      } else {
        n0++;
      }
    }
    long long base = pow(2, i);
    base %= MOD;
    base = (base * n0 * n1) % MOD;
    ans = (ans + base) % MOD;
  }
  cout << ans << endl;
}
