#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int mod = 1000000007;
  vector<long> A(N + 1, 0);
  for (int i = 1; i <= N; i++) {
    cin >> A.at(i);
  }
  long s = 0;
  for (int i = 1; i < N; i++) {
    for (int j = i + 1; j <= N; j++) {
      long a = (A.at(i) xor A.at(j)) % mod;
      s += a;
    }
  }
  s %= mod;
  cout << s << endl;
}
