#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long long n, a[300000];
  cin >> n;
  for (unsigned long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  unsigned long long ans = 0;
  for (unsigned long long i = 0; i < n - 1; ++i) {
    for (unsigned long long j = i + 1; j < n; ++j) {
      unsigned long long test = a[i] ^ a[j];
      ans += test;
    }
  }
  unsigned long long q = pow(10, 9) + 7;
  cout << ans % q;
  unsigned long long x = 3 ^ 5;
}
