#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[300000];
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += int(A[i] xor A[j]);
    }
  }
  if (sum < 1000000007) {
    cout << sum << endl;
  } else if (sum > 1000000007) {
    while (true) {
      if (sum - 1000000007 < 0) {
        cout << sum << endl;
        break;
      }
      if (sum - 1000000007 == 0) {
        cout << "0" << endl;
      }
      sum = sum - 1000000007;
    }
  }
  return 0;
}
