#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1000000007;
int main() {
  int n;
  scanf("%d", &n);
  int zero[64];
  int one[64];
  memset(zero, 0, sizeof(zero));
  memset(one, 0, sizeof(one));
  unsigned long long bit = 1;
  for (int i = 0; i < n; i++) {
    unsigned long long v;
    scanf("%lld", &v);
    for (int j = 0; j < 64; j++) {
      if (v & (bit << j)) {
        one[j]++;
      }
      if ((~v) & (bit << j)) {
        zero[j]++;
      }
    }
  }
  unsigned long long ans = 0;
  for (int i = 0; i < 64; i++) {
    int x = zero[i] * one[i];
    for (int j = 0; j < x; j++) {
      ans = (ans + (bit << i)) % MOD;
    }
  }
  cout << ans << endl;
}
