#include <bits/stdc++.h>
using namespace std;
static const unsigned long long MOD = 1000000007;
int main() {
  unsigned long long N;
  cin >> N;
  unsigned long long A[N];
  unsigned long long E[61];
  unsigned long long O[61];
  for (unsigned long long i = 0; i < 60; i++) {
    E[i] = 0;
    O[i] = 0;
  }
  for (unsigned long long i = 0; i < N; i++) {
    cin >> A[i];
    for (unsigned long long j = 0; j < 61; j++) {
      if (A[i] & (1 << j)) {
        O[j]++;
      } else {
        E[j]++;
      }
    }
  }
  unsigned long long ans = 0;
  unsigned long long t = 1;
  for (long long i = 0; i < 31; i++) {
    ans = (ans + t * O[i] * E[i]) % MOD;
    t = (t * 2) % MOD;
  }
  cout << ans << endl;
  return 0;
}
