#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j;
  cin >> n;
  long long int a[n + 1], sum = 0, c;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (i != j) {
        c = a[i] ^ a[j];
        sum = (sum + c) % 1000000007;
      }
    }
  }
  cout << sum / 2;
}
