#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  vector<unsigned long long int> a;
  for (int i = 0; i < n; i++) {
    unsigned long long int ai;
    cin >> ai;
    a.push_back(ai);
  }
  unsigned long long int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      unsigned long long int x = a[i] ^ a[j];
      sum += x;
    }
  }
  sum = sum % 1000000007;
  cout << sum << endl;
  return 0;
}
