#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, sum = 0;
  cin >> n;
  long long int a[n];
  long long int power = (long long int)pow(10, 9) + 7;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = a[i];
    for (long long int j = i - 1; j >= 0; j--) {
      sum = (sum % power + ((a[i] ^ a[j]) % (power))) % power;
    }
  }
  cout << sum % power;
}
