#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace std::literals;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];

  using big = unsigned __int128;

  constexpr unsigned long long m = 1'000'000'000 + 7;

  big sum = 0;

  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum += a[i] ^ a[j];
    }
  }

  cout << (long long)(sum % m);
  return 0;
}
