#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using edge = struct {
  int to;
  long long cost;
};
template <class t, class u>
void chmax(t& a, u b) {
  if (a < b) a = b;
}
template <class t, class u>
void chmin(t& a, u b) {
  if (b < a) a = b;
}
long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    long long tmp = 0;
    cin >> tmp;
    a[i] = tmp;
  }
  long long sum;
  sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; j++) {
      sum = sum + (a[i] ^ a[j]);
      if (sum > mod) {
        sum = sum % mod;
      }
    }
  }
  cout << sum << endl;
}
