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