#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
int main() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int bit = 0; bit < 60; bit++) {
    int bitCount = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] >> bit) & 1) bitCount++;
    }
    long long tmp = bitCount * (N - bitCount) % MOD;
    tmp *= (long long)pow(2LL, bit) % MOD;
    ans += tmp % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << endl;
  return 0;
}
