#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long answer = 0;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      answer += (a[i] ^ a[j]) % MOD;
    }
  }
  cout << answer % MOD;
  return 0;
}
