#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  long long sum = 0, tmp;
  int n;
  vector<long long> ns;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    ns.push_back(tmp);
  }
  for (int i = 0; i < ns.size() - 1; i++) {
    for (int j = i + 1; j < ns.size(); j++) {
      sum += (ns[i] ^ ns[j]) % MOD;
      sum = sum % MOD;
    }
  }
  cout << sum % MOD << endl;
  return 0;
}
