#include <bits/stdc++.h>
using namespace std;
const long long DIM = 1e9 + 7;
unsigned long long v[300005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  long long rez = 0;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) rez = (rez + (v[i] ^ v[j]) % DIM) % DIM;
  cout << rez;
  return 0;
}
