#include <bits/stdc++.h>
using namespace std;
const int INT_INF = 1e9;
const long long INF = 1LL << 30;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<long long> > memo(n, vector<long long>(n, -1));
  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (a[i] ^ a[j]) % MOD;
    }
  }
  cout << sum % MOD << endl;
}
