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