#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N + 4);
  long long map[N + 4][N + 4];
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i < N; i++) map[i][N - 1] = (a[i] ^ a[N - 1]) % MOD;
  for (int i = 0; i < N; ++i) {
    for (int j = N - 2; j >= 0; --j) {
      map[i][j] = (map[i][j + 1] + (a[i] ^ a[j]) % MOD) % MOD;
    }
  }
  long long ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    ans += map[i][i + 1];
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
