#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  unsigned long long int lis[n], sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> lis[i];
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      sum += (((lis[i] % 1000000007) ^ (lis[j] % 1000000007)) % 1000000007) %
             1000000007;
    }
  }
  cout << sum << "\n";
  return 0;
}
