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