#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j) {
      ans += a[i] ^ a[j];
      ans %= MOD;
    }
  }
  cout << (ans) << "\n";
}
