#include <bits/stdc++.h>
using namespace std;
long long int ansgudge(long long int a) {
  if (a >= 1000000007)
    return ansgudge(a - 1000000007);
  else if (a < 0)
    return ansgudge(a + 1000000007);
  else
    return a;
}
int main() {
  int N;
  long long int ans = 0;
  cin >> N;
  long long int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
      ans = ansgudge(ans);
    }
  }
  cout << ans << endl;
  return 0;
}
