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