#include <bits/stdc++.h>
using namespace std;
string ent = "\n";
string space = " ";
long long arr[40040];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long total = 0;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      total += (arr[i] ^ arr[j]) % 1000000007;
    }
  }
  cout << total % 1000000007 << ent;
}
