#include <bits/stdc++.h>
using namespace std;
long long arr[200000];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  int N;
  long long answer = 0;
  long long div = pow(10, 9) + 7;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> arr[i];
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      answer += (arr[i] ^ arr[j]);
    }
    answer %= div;
  }
  answer %= div;
  cout << answer << endl;
  return 0;
}
