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