#include <bits/stdc++.h>
using namespace std;
constexpr double pi = M_PI;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  long long sum = 0;
  constexpr long long mod = 1000000007;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    for (long long j = 0; j < i; j++) {
      sum += a[i] ^ a[j];
      sum %= mod;
    }
  }
  cout << (sum % mod) << endl;
}
