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