#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a, b = 0, c[1000000];
  cin >> a;
  for (long long i = 0; i < a; i++) {
    cin >> c[i];
  }
  for (long long i = 0; i < a; i++) {
    for (long long j = i + 1; j < a; j++) {
      b = (b + (c[i] ^ c[j]) % 1000000007) % 1000000007;
    }
  }
  cout << b << "\n";
}
