#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
const int max_n = 3 * 1e5 + 1;
const long long int INF = 10241024;
long double INFD = 100100100;
int N;
vector<int> v(max_n);
void input() {
  cin >> N;
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> v[i];
  }
}
void solve() {
  input();
  int sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      int a = v[i] ^ v[j];
      sum += a;
    }
  }
  int ans = sum % Mod;
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
