#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int64_t>>;
const double pi = M_PI;
const uint64_t MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  uint64_t a[n], ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int k = i + 1; k < n; k++) {
      ans += (a[i] ^ a[k]) % MOD;
      ans %= MOD;
    }
  }
  cout << ans % MOD << endl;
  return 0;
}
