#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1001001001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
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 << endl;
}
