#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
int main() {
  int n;
  cin >> n;
  long long arr[n + 1];
  long long sum = 0;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum = (sum + (arr[i] ^ arr[j]) % m) % m;
    }
  }
  cout << sum << '\n';
}
