#include <bits/stdc++.h>
using namespace std;
long long n, a[300000], memo[60], hoge[300000][60], ans;
signed main() {
  cin >> n;
  for (long long i = 0; i < (long long)(n); ++i) {
    cin >> a[i];
    long long z = 0;
    while (a[i]) {
      memo[z] += a[i] % 2;
      hoge[i][z] = a[i] % 2;
      a[i] /= 2;
      z++;
    }
  }
  for (long long i = 0; i < (long long)(n); ++i) {
    long long z = 1;
    for (long long j = 0; j < (long long)(60); ++j) {
      if (!hoge[i][j]) ans = (ans + memo[j] * z) % 1000000007;
      z *= 2;
    }
  }
  cout << ans << endl;
}
