#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int gcd(int m, int n) { return !n ? m : gcd(n, m % n); }
template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = std::vector<std::vector<T>>;
template <typename T>
using VVV = std::vector<std::vector<std::vector<T>>>;
template <typename T>
void view(const T e) {
  std::cout << e << std::endl;
}
template <typename T>
void view(const std::vector<T>& v) {
  for (const auto& e : v) std::cout << e << " ";
  std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>>& vv) {
  for (const auto& v : vv) {
    view(v);
  }
}
int main() {
  int N;
  cin >> N;
  vector<long> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  unsigned long long sums = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      sums += A[i] ^ A[j];
    }
  }
  cout << sums % 1000000007 << endl;
  return 0;
}
