#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n, 0);
  long long result = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] %= 1000000000 + 7;
  }
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) result += a[i] ^ a[j];
  result %= 1000000000 + 7;
  printf("%d", result);
  return 0;
}
