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