#include <bits/stdc++.h>
using namespace std;
long long xorab(long long a, long long b) { return a ^ b; }
void solve() {
  long long n, sum = 0;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j) sum += xorab(a[i], a[j]);
  cout << sum % ((int)1e9 + 7) << endl;
}
int main() {
  solve();
  return 0;
}
