#include <bits/stdc++.h>
using namespace std;
long long A = (long long)pow(2, 59), x, A2, ans = 0;
int main() {
  int n;
  cin >> n;
  long long D[300005];
  for (int i = 0; i < (n); ++i) cin >> D[i];
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j)
      ans = (ans + (D[i] ^ D[j])) % 1000000007;
  }
  cout << ans << endl;
}
