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