#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long s = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      s += a[i] ^ a[j];
      ;
      cout << i + 1 << ", " << j + 1 << ": " << s << endl;
    }
  }
  cout << s << endl;
  s %= (long long)1e9 + 7;
  cout << s << endl;
}
