#include <bits/stdc++.h>
using namespace std;
int XOR(int x, int y) {
  int k = 0, b[64] = {0}, c[64] = {0}, sumv[64] = {0};
  while (x > 0) {
    b[k] = x % 2;
    k++;
    x /= 2;
  }
  k = 0;
  while (y > 0) {
    c[k] = y % 2;
    k++;
    y /= 2;
  }
  for (k = 0; k < 64; k++) {
    if (b[k] == c[k])
      sumv[k] = 0;
    else
      sumv[k] = 1;
  }
  long long m = 1, total = 0;
  for (k = 0; k < 64; k++) {
    total += sumv[k] * m;
    m *= 2;
  }
  return total;
}
int main() {
  long long i, j, n, sum = 0;
  cin >> n;
  int a[n + 1];
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    for (j = 1; j < i; j++) {
      sum += XOR(a[i], a[j]);
    }
  }
  cout << sum % 1000000007;
  return 0;
}
