#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, sum = 0, temp, j;
  long long int m = 1000000007;
  cin >> n;
  vector<long long int> v(n, 0);
  cin >> v[0];
  for (i = 1; i < n; i++) {
    cin >> temp;
    for (j = 0; j < i; j++) {
      sum += ((v[j] ^ temp) % m);
    }
    v[i] = temp;
  }
  sum = sum % m;
  cout << sum << endl;
  return 0;
}
