#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void) {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i += 1) {
    cin >> v[i];
  }
  for (int i = 0; i < (n - 1); i += 1) {
    for (int k = i + 1; k < n; k += 1) {
      ans += (v[i] ^ v[k]) % (1000000007);
    }
  }
  cout << ans % (1000000007) << endl;
  return 0;
}
