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