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