#include <bits/stdc++.h>
int main() {
  int n{};
  std::cin >> n;
  std::vector<unsigned long long> v(n);
  for (int i = 0; i < n; i++) {
    std::cin >> v[i];
  }
  unsigned long long total{};
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      total += v[i] ^ v[j];
      while (total >= 1000000007) {
        total -= 1000000007;
      }
    }
  }
  std::cout << total << std::endl;
}
