#include <bits/stdc++.h>
using namespace std;
int N;
unsigned long long int A[300000];
unsigned long long int ans = 0;
void solve() {
  for (int i = 0; i < N - 1; i++) {
    for (int j = i; j < N; j++) {
      unsigned long long int xornum = A[i] ^ A[j];
      ans += xornum;
      ans = ans % 1000000007;
    }
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] = A[i];
  }
  solve();
  cout << ans;
  return 0;
}
