#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n;
  long long xr;
  long long ara[300001];
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &ara[i]);
  for (i = 0, xr = 0; i < 64; i++) {
    int zc = 0, ac = 0;
    long long isum = 0;
    for (j = 0; j < n; j++) {
      if (ara[j] % 2 == 0)
        zc++;
      else
        ac++;
      ara[j] = ara[j] >> 1;
    }
    isum = ac * zc * pow(2, i);
    xr = ((xr % 1000000007) + (isum % 1000000007)) % 1000000007;
  }
  printf("%lld\n", xr % 1000000007);
  return 0;
}
