#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long A[n], mod = 1e9 + 7, ans = 0;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i <= n - 2; i++) {
    for (int j = i; j <= n - 1; j++) {
      ans += A[i] ^ A[j];
    }
  }
  cout << ans % mod << endl;
}
