#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  vector<ll> a(t);
  for (auto &i : a) cin >> i;
  int i, j;
  long long int sum = 0;
  for (i = 0; i < t - 1; i++) {
    for (j = i + 1; j < t; j++) sum = (sum + (a[i] ^ a[j]));
  }
  cout << sum % mod << "\n";
}
