#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int M = 3e5 + 50;
int a[M][65] = {0};
int main() {
  int n;
  scanf("%d", &n);
  int l = 0;
  for (int i = 0; i < n; i++) {
    long long shu;
    scanf("%lld", &shu);
    int wz = 0;
    while (shu) {
      if (shu & 1) a[i][wz] = 1;
      wz++;
      shu >>= 1;
    }
    l = max(l, wz);
  }
  long long sum = 0;
  for (int i = 0; i <= 60; i++) {
    long long z, o;
    z = o = 0;
    long long q = 1 << i;
    q %= mod;
    for (int j = n - 1; j >= 0; j--) {
      if (a[j][i]) {
        sum += z;
        o += q;
        o %= mod;
      } else {
        sum += o;
        z += q;
        z %= mod;
      }
      sum %= mod;
    }
  }
  printf("%lld\n", sum);
  return 0;
}
