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