#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> A.at(i);
  }
  const int mod = 1000000007;
  long long ans = 0;
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      ans = (ans + (A.at(i) ^ A.at(j))) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
