#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n + 10];
  long long int s = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i + 1; j < n; j++) {
      s += (a[i] ^ a[j]) % 1000000007;
    }
  }
  cout << s % 1000000007 << '\n';
  s = 0;
}
