#include <bits/stdc++.h>
using namespace std;
const int LOG = 60;
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);
      int ind = (v & pot) ? 1 : 0;
      ans += pot * qtdBits[j][1 - ind];
      ans %= MOD;
      qtdBits[j][ind]++;
    }
  }
  printf("%lld\n", ans);
}
