#include <bits/stdc++.h>
using namespace std;
long long a[300000 + 10];
int main() {
  long long sum = 0;
  long long n, h;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> h;
    a[i] = h;
  }
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) sum += (a[i] ^ a[j]) % (1000000000 + 7);
  cout << sum % (1000000000 + 7);
}
