#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long c = 1000000000 + 7;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long res = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) res = ((a[i] ^ a[j]) % c + res) % c;
  cout << res;
  return 0;
}
