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