#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int N;
long long A[300001], ans;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%ld", &A[i]);
  }
  for (int i = 0; i < 60; ++i) {
    int cnt1 = 0;
    for (int j = 1; j <= N; ++j) {
      if (A[j] >> i & 1) ++cnt1;
    }
    ans += (1LL << i) * cnt1 % MOD * (N - cnt1) % MOD;
  }
  printf("%ld\n", ans % MOD);
}
