#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool IsPrime(int);
int Factorial(int);
int NPR(int, int);
int NCR(int, int);
signed main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  ll total = 0;
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j) {
      total += a[i] ^ a[j];
    }
  }
  cout << total % 1000000007;
  cout << "\n";
  return 0;
}
bool IsPrime(int a) {
  if (a <= 1) return false;
  if (a == 2) return true;
  if (a % 2 == 0) return false;
  for (int i = 3; i * i <= a; i += 2) {
    if (a % i == 0) return false;
  }
  return true;
}
int Factorial(int n) {
  int ans = 1;
  while (n > 1) {
    ans *= n;
    --n;
  }
  return ans;
}
int NPR(int n, int r) { return Factorial(n) / Factorial(n - r); }
int NCR(int n, int r) { return NPR(n, r) / Factorial(r); }
