#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> nums(0);
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    nums.push_back(a);
  }
  long long total = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i; j < N; j++) {
      total = (total + (nums.at(i) ^ nums.at(j))) % MOD;
    }
  }
  cout << total << endl;
  return 0;
}
