#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2000000;
const long long MOD = 1000000007;
long long n;
int main() {
  cin >> n;
  long long a[n];
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    long long tempA;
    cin >> tempA;
    a[i] = tempA;
    for (long long j = 0; j < i; j++) {
      sum = (sum + (a[j] ^ tempA) % MOD) % MOD;
    }
  }
  cout << sum << endl;
  return 0;
}
