#include <bits/stdc++.h>
using namespace std;
void solution() {
  int n;
  cin >> n;
  vector<long int> A(n);
  for (int i = 0; i <= n - 1; i++) cin >> A[i];
  long long int sum = 0;
  for (int i = 0; i <= n - 2; i++) {
    for (int j = i + 1; j <= n - 1; j++) {
      sum += (A[i] ^ A[j]);
      sum = sum % 1000000007;
    }
  }
  cout << sum << endl;
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solution();
  return 0;
}
