#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int sum, sum_i;
int main(void) {
  int n;
  int base = 1;
  cin >> n;
  int a[n];
  int bit[17][n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < 17; i++) {
      bit[i][j] = a[j] % 2;
      a[j] /= 2;
    }
  }
  for (int k = 0; k < n - 1; k++) {
    for (int j = 0; j < n + 1; j++) {
      for (int i = 0; i < 16; i++) {
        sum_i += (bit[i][k] ^ bit[i][j]) * base;
        base *= 2;
      }
      base = 1;
    }
  }
  cout << sum_i % MOD << endl;
  return 0;
}
