#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n, 0);
  for (long long(i) = 0; i < (n); i++) cin >> a.at(i);
  for (long long(i) = 0; i < (n - 1); i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += a.at(j) ^ a.at(i);
      ans %= MOD;
    }
  }
  cout << ans;
}
