#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long N, cnt[100000][100], A[100000], sum[100];
int main(void) {
  cin >> N;
  for (int i = 0; i < (N); ++i) {
    cin >> A[i];
    long long x = A[i];
    long long m = 0;
    while (x > 0) {
      if (x & 1 == 1) cnt[i][m]++;
      x = x >> 1;
      m++;
    }
    for (int j = 0; j < (61); ++j) sum[j] += cnt[i][j];
  }
  long long ans = 0;
  for (int i = 0; i < (N); ++i) {
    long long p = 1;
    for (int j = 0; j < (61); ++j) {
      sum[j] -= cnt[i][j];
      if (cnt[i][j] == 0)
        ans = (ans + (sum[j] * p) % MOD) % MOD;
      else
        ans = (ans + ((N - 1 - i - sum[j]) * p) % MOD) % MOD;
      p = (2 * p) % MOD;
    }
  }
  ans = ans % MOD;
  cout << ans << endl;
}
