#include <bits/stdc++.h>
using namespace std;
const int N = 300010, Mod = 1e9 + 7;
long long a[N];
int ans = 0;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      ans = (ans + (a[i] ^ a[j] % Mod)) % Mod;
    }
  }
  cout << ans << endl;
  return 0;
}
