#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int sum = 0;
  for (long long int i = 0; i < n - 1; i++) {
    for (long long int j = i + 1; j < n; j++) {
      sum += a[i] ^ a[j];
      sum %= MOD;
    }
  }
  cout << sum << endl;
}
