#include <bits/stdc++.h>
using namespace std;
long long int map[400000][200];
long long int b[400000], ba[400000], dab[400000];
int main() {
  long long int n, i, m, j;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
  }
  for (i = 1; i <= n; i++) {
    long long int val = b[i], t = 1;
    while (val != 0) {
      if (val % 2 == 1) {
        map[i][t] = 1;
        ba[t]++;
      }
      val /= 2;
      t++;
    }
  }
  long long int cnt = n;
  for (i = 1; i < n; i++) {
    for (j = 1; j <= 70; j++) {
      if (map[i][j] == 1) ba[j]--;
    }
    cnt--;
    for (j = 1; j <= 70; j++) {
      if (map[i][j] == 1) ba[j] = cnt - ba[j];
    }
    for (j = 1; j <= 70; j++) dab[j] += ba[j];
    for (j = 1; j <= 70; j++) {
      if (map[i][j] == 1) ba[j] = cnt - ba[j];
    }
  }
  long long int t = 1, ccount = 0;
  for (i = 1; i <= 70; i++) {
    ccount += (t * dab[i]) % 1000000007;
    ccount %= 1000000007;
    t *= 2;
    t %= 1000000007;
  }
  printf("%lld", ccount);
  return 0;
}
