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