#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
long long mod_pow(long long a, long long N) {
  if (N == 0) return 1;
  if (N % 2 == 1) return (a * mod_pow(a, N - 1)) % p;
  long long tmp = mod_pow(a, N / 2);
  return (tmp * tmp) % p;
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long keta = 0, tmp = *max_element(A.begin(), A.end());
  while (tmp > 0) {
    tmp /= 2;
    keta++;
  }
  vector<pair<long long, long long>> dig(keta, make_pair(0, 0));
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < keta; j++) {
      if (A[i] & (1 << j))
        dig[j].first++;
      else
        dig[j].second++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < keta; i++) {
    long long tmp = mod_pow(2, i);
    tmp *= dig[i].first;
    tmp %= p;
    tmp *= dig[i].second;
    tmp %= p;
    ans += tmp;
    ans %= p;
  }
  cout << ans % p << endl;
}
