#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
void input() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A.at(i));
  }
}
void solve() {
  input();
  int sum = 0;
  for (int i = 1; i <= N - 1; i++) {
    for (int j = 1; j <= N; j++) {
      sum += (A.at(i) ^ A.at(j));
    }
  }
  int ans;
  ans = sum / (1000000000 + 7);
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
