#include <bits/stdc++.h>
using namespace std;
int main() {
  const int INF = pow(10, 9) + 7;
  int n;
  cin >> n;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += A[i] ^ A[j];
      ans %= INF;
    }
  }
  cout << ans << endl;
}
