#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e9;
static const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  long long a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  map<long long, long long> ma;
  for (int i = 0; i < N; i++) {
    long long res = a[i];
    long long tmp = 1;
    while (res) {
      ma[tmp] += res % 2;
      res /= 2;
      tmp *= 2;
    }
  }
  long long ans = 0;
  for (auto it = ma.begin(); it != ma.end(); it++) {
    ans += (it->first % MOD) * (it->second) * (N - it->second) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
