#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  const int64_t mod = 1000000007;
  int N;
  cin >> N;
  vector<int64_t> a(N, 0);
  for (int i = 0; i < N; i++) {
    int64_t a1;
    cin >> a1;
    a[i] = a1;
  }
  int64_t ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += a[i] ^ a[j];
    }
  }
  ans = ans % mod;
  cout << ans << endl;
  return 0;
}
