#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int INF = 1000000;
const double PI = 3.14159265359;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < (n - 1); i++) {
    for (long long j = i + 1; j < (n); j++) {
      if (a[i] == a[j]) continue;
      ans += (a[i] ^ a[j]);
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
