#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long INF = 1000000000000000000;
long long A[300010];
long long R[100];
long long m = 0;
void check(long long X) {
  long long i = 0;
  while (X > 0) {
    R[i] += X % 2;
    X /= 2;
    i++;
  }
  m = max(m, i);
}
int main() {
  int N;
  cin >> N;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    check(A[i]);
  }
  for (long long i = 0; i <= m; i++) {
    long long up = 1;
    for (long long j = 0; j < i; j++) {
      up *= 2;
    }
    long long r = N - R[i];
    ans = (ans + (r * R[i]) % mod * up % mod) % mod;
  }
  cout << ans % mod << endl;
}
