#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300000;
int N;
long long A[MAX_N];
const long long MOD = 1e9 + 7;
void Main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  long long bit = 1;
  for (int i = 0; i < 60; i++) {
    int c0 = 0, c1 = 0;
    for (int j = 0; j < N; j++)
      if (A[j] & (1LL << i))
        c1++;
      else
        c0++;
    (ans += (c0 * c1) % MOD * bit % MOD) %= MOD;
    (bit *= 2) %= MOD;
  }
  cout << ans % MOD << endl;
}
int main() {
  Main();
  return 0;
}
