#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int mod(1e9 + 7);
long long a[300005], res;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j <= n; ++j) res += a[i] ^ a[j];
    res %= mod;
  }
  cout << res;
  exit(0);
}
