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