#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (int)N; i++) {
    cin >> a[i];
  }
  unsigned long long sum = 0;
  const unsigned long long MOD = pow(10, 9) + 7;
  for (int i = 0; i < (int)N; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += a[i] ^ a[j];
      sum = sum % MOD;
    }
  }
  cout << sum % MOD << endl;
}
