#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k, c = 0, d = 0, flag = 0, max = 0, min1 = 10000000000,
                            max1 = 0, l, r, T, m, x, y, count1 = 0, q;
  cin >> n;
  long long int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      count1 += a[i] ^ a[j];
    }
  }
  cout << (count1) % 1000000007 << endl;
  return 0;
}
