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