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