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