#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long kotae = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      kotae += a[i] ^ a[j];
      kotae %= MOD;
    }
  }
  cout << kotae << endl;
  return 0;
}
