#include <bits/stdc++.h>
using namespace std;
long long int i, j, k, l, sum = 0, ar[100009], a, n, t, m, br[1000009], b, sum2,
                          cnt, cnt1, cnt2, d, e, f, r, cr[100008];
string s;
int main() {
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> ar[i];
  }
  for (i = 0; i < t; i++) {
    for (j = i + 1; j < t; j++) {
      r = ar[i] ^ ar[j];
      sum = sum + r;
    }
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
