#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000;
int n;
int64_t mod = 1e9 + 7;
int64_t ans = 0;
int64_t a[maxn];
int64_t cnt[maxn][60];
int main() {
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  int64_t b = 1;
  for (long long int i = 0; i < 59; i++) b = b * 2;
  for (long long int i = 0; i < n; i++) {
    int c = 59;
    int64_t t = b;
    while (a[i] > 0) {
      if (a[i] >= t)
        cnt[i][c] = 1;
      else
        cnt[i][c] = 0;
      c--;
      a[i] = a[i] % t;
      t = t / 2;
    }
  }
  int64_t t = 1;
  for (long long int i = 0; i < 60; i++) {
    int64_t A = 0;
    for (long long int j = 0; j < n; j++) {
      if (cnt[j][i] == 1) A++;
    }
    int64_t B = n - A;
    ans += A * B * t;
    ans %= mod;
    t = t * 2;
  }
  cout << ans << endl;
  return 0;
}
