#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
long long a[maxn];
int main() {
  int n;
  long long sum = 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] % 1000000007) ^ a[j]) % 1000000007;
    }
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
