#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  std::cin >> n;
  std::vector<long long> a(n);
  for (unsigned long long i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  unsigned long long ch = 0;
  unsigned long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += ((a[i] ^ a[j]) % (1000000000 + 7)) % (1000000000 + 7);
    }
  }
  std::cout << ans << '\n';
  return 0;
}
