#include <bits/stdc++.h>
long long mod = (long long)1e9 + 7;
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N + 5, 0);
  long long maxvalue = 0;
  for (long long i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    maxvalue = fmax(maxvalue, A[i]);
  }
  long long ans = 0;
  long long multiple = 1;
  int i = 0;
  while (maxvalue > 0) {
    long long count = 0;
    for (long long j = 0; j < N; j++) {
      if ((A[j] % 2) == 1) {
        count++;
      }
      A[j] /= 2;
    }
    maxvalue /= 2;
    ans += (count * (N - count)) % mod;
    ans *= multiple;
    ans %= mod;
    multiple *= 2;
    multiple %= mod;
    i++;
  }
  printf("%lld\n", ans);
  return 0;
}
