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