#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1000000007;
int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<unsigned long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  unsigned long long result(0);
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      unsigned long long term = (a[i] ^ a[j]) % mod;
      result = (result + term) % mod;
    }
  }
  cout << result << "\n";
  return 0;
}
