#include <bits/stdc++.h>
using namespace std;
long long n, a[300004], ans;
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += a[i] ^ a[j];
      ans %= (long long)(1000000007);
    }
  }
  cout << ans << endl;
}
