#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int(n);
  cin >> (n);
  int a[n];
  for (int i = 0; i < (n); i++) cin >> a[i];
  ;
  long long sum = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
      sum = (sum + (long long)a[i] ^ a[j]) % 1000000007;
  cout << sum;
  return 0;
}
