#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  long long n;
  cin >> n;
  long long count = 0;
  long long *arr = new long long[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      count += (arr[i] ^ arr[j]) % mod;
      count = count % mod;
    }
  }
  cout << count;
  return 0;
}
