#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m, A[100000], n;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  A[n + 1] = 0;
  int sum = 0;
  for (i = 1; i < n; i++) {
    for (j = i + 1; j <= n; j++) {
      sum = sum + (A[i] ^ A[j]);
    }
  }
  cout << sum % 1000000007;
}
