#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e9 + 7;
long long a[1000000];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (long long i = 1; i <= n - 1; i++) {
    for (long long j = i + 1; j <= n; j++) {
      sum += a[i] ^ a[j];
      sum %= maxn;
    }
  }
  cout << sum << endl;
  return 0;
}
