#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long mod = 1e9 + 7;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += (a[i] ^ a[j]) % mod;
    }
  }
  cout << ans % mod << endl;
}
