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