#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  const int mod = 1e9 + 7;
  long long int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long int answer = 0;
  long long int tmp = 0;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      answer = answer + (a[i] ^ a[j]);
    }
  }
  cout << answer % (mod);
}
