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