#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int MAX = 1000000000;
const long long MOD = 1000000007;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int main(void) {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    long long s = 0;
    long long d;
    for (long long j = 0; j < N; j++) {
      d = 1LL << i;
      if (A[j] & d) {
        s++;
      }
    }
    ans += (d * s * (N - s)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
