#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a;
  for (int i = 0; i < n; ++i) {
    long long val;
    cin >> val;
    a.push_back(val);
  }
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j + i < n; ++j) {
      ans += (a[j] ^ a[j + i]);
    }
  }
  ans %= (1000000000 + 7);
  cout << ans << '\n';
  return 0;
}
