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