#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  vector<unsigned long long> v(n);
  for (auto& x : v) cin >> x;
  unsigned long long sum{0};
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) sum = (sum + (v[i] ^ v[j])) % 1000000007;
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
