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