#include <bits/stdc++.h>
using namespace std;
const int LOG = 62;
const int MOD = 1000000007;
int n;
int qtdBits[LOG][2];
long long int ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long int v;
    scanf("%lld", &v);
    for (int j = 0; j < LOG; j++) {
      long long int pot = (1LL << j);
      pot %= MOD;
      if (v & pot)
        ans += qtdBits[j][0] * pot;
      else
        ans += qtdBits[j][1] * pot;
    }
    for (int j = 0; j < LOG; j++) {
      if (v & (1LL << j))
        qtdBits[j][1]++;
      else
        qtdBits[j][0]++;
    }
    ans %= MOD;
  }
  printf("%lld\n", ans);
}
