#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  vector<unsigned long long> a(n);
  for (int 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) {
      if (j > i) {
        ans += a[i] ^ a[j];
        if (ans > (unsigned long long)(1e9 + 7))
          ans %= (unsigned long long)1e9 + 7;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
