#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> h;
  long long tmp = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> tmp;
    h.push_back(tmp);
  }
  long long sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i; j < N; j++) {
      sum += (h[i] xor h[j]) % MOD;
    }
  }
  cout << sum % MOD << endl;
}
