#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n;
  scanf("%d", &n);
  cout << n << endl;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    long long v;
    scanf("%lld", &v);
    a[i] = v;
  }
  long long ans = 0;
  for (int l = 0; l < n - 1; l++) {
    for (int r = l + 1; r < n; r++) {
      ans = (ans + (a[l] ^ a[r])) % MOD;
    }
  }
  cout << ans << endl;
}
