#include <bits/stdc++.h>
using namespace std;
void sinsu(int decimal, int binary[]) {
  for (int i = 0; decimal > 0; i++) {
    binary[i] = decimal % 2;
    decimal = decimal / 2;
  }
}
int main() {
  int N, A[N], B[32], A_tr[N][32], sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    sinsu(A[i], B);
    for (int j = 0; j < N; j++) A_tr[i][j] = B[j];
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = 0; k < N; k++) {
        if (A_tr[i][k] != A_tr[j][k]) sum = sum + pow(2, k);
      }
    }
  }
  sum = sum % (int)(pow(10, 9) + 7);
  cout << sum << endl;
}
