#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  vector<long long> a(n);
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++) {
      ret = (ret + (a[i] ^ a[j])) % MOD;
    }
  }
  cout << ret << endl;
}
