#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 100000;
const int INF = 1e9;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
ll A[3 * 100000];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < (N); i++) cin >> A[i];
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans = (ans + (A[i] ^ A[j])) % 1000000007;
    }
  }
  cout << ans << endl;
}
