#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n, x;
  cin >> n;
  unsigned long long int a[n];
  for (unsigned long long int i = 0; i < n; i++) {
    cin >> x;
    a[i] = x;
  }
  unsigned long long int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      x = (a[i] ^ a[j]) % 1000000007;
      ans = (ans + x) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
