#include <bits/stdc++.h>
using namespace std;
long long const m = 1000000007;
long long power(long long a, long long n) {
  if (n == 0)
    return 1;
  else if (n == 1)
    return a;
  else {
    long long res = power(a, n / 2);
    if (n % 2 == 0)
      return (res) * (res);
    else
      return (res) * (res) * (a);
  }
}
int main() {
  long long n, i, j, k, count = 0;
  cin >> n;
  long long arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      count += (arr[i] ^ arr[j]);
      count %= m;
    }
  }
  cout << count << "\n";
  return 0;
}
