#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  int n;
  ull tmp;
  ull mod = 1000000007;
  vector<ull> a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  tmp = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      tmp += a[i] ^ a[j];
      tmp %= mod;
    }
  }
  cout << tmp << endl;
}
