#include <bits/stdc++.h>
using namespace std;
long long i[300010];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a, b, c = 0, d = 0, e = 0;
  cin >> a;
  for (int n = 0; n < a; n++) cin >> i[n];
  for (int n = 0; n < a - 1; n++) {
    for (int m = n + 1; m < a; m++) {
      d += i[n] ^ i[m];
      d = d % 1000000007;
    }
  }
  cout << d << '\n';
  return 0;
}
