#include <bits/stdc++.h>
using lint = long long;
using namespace std;
const int MOD = 1000000007;
const lint INF = 1LL << 60;
const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;
int main() {
  int N;
  lint A[300050];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  int d[60];
  lint ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      d[j] += (A[i] >> j) & 1;
    }
  }
  for (int i = 0; i < 60; i++) {
    if (d[i] == 0) continue;
    ans += (1LL << i) * d[i] * (N - d[i]);
  }
  cout << ans % MOD << endl;
  return 0;
}
