#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long sum = 0, mod = 1e9 + 7;
  for (long long i = 0; i < n; i++)
    for (long long j = i + 1; j < n; j++)
      sum += ((v[i] % mod) ^ (v[j] % mod)) % mod;
  cout << sum % mod << endl;
}
