#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, a[300000], countx = 0, m = 1000000007;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      countx += (a[i] ^ a[j]) % m;
      countx = countx % m;
    }
  }
  cout << countx % m << endl;
  return 0;
}
