#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <typename T>
using V = vector<T>;
using Vi = V<int>;
using Vll = V<LL>;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  Vll 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)++) {
      LL xor_num = (a[i] ^ a[j]) % MOD;
      total = (total + xor_num) % MOD;
    }
  }
  cout << total << endl;
  return 0;
}
