#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long long;
int main() {
  ul N;
  cin >> N;
  vector<ul> A(N + 1);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i + 1];
  }
  ul ans = 0;
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      ans += (A[i] ^ A[j]);
    }
  }
  cout << (ans % 1000000007) << endl;
}
