#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  long long s[1010101];
  long long ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < i; j++) {
      ma = (ma + (s[j] ^ s[i])) % MOD;
    }
  }
  cout << ma << endl;
}
