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