#include <bits/stdc++.h>
using namespace std;
const long long p = 1000000007;
int main() {
  long long N;
  cin >> N;
  long long A[N];
  long long tempmax = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] > tempmax) tempmax = A[i];
  }
  long long ans = 0;
  long long pow2 = 1;
  while (tempmax > 0) {
    long long bit[N];
    long long ones = 0;
    for (long long i = 0; i < N; i++) {
      bit[i] = A[i] % 2;
      if (bit[i] == 1) ones++;
      A[i] = A[i] / 2;
    }
    ans += ones * (N - ones) * pow2;
    ans %= p;
    pow2 = (pow2 * 2) % p;
    tempmax /= 2;
  }
  cout << ans << endl;
}
