#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
int main() {
  long long n, ans = 0;
  cin >> n;
  long long arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      ans += arr[i] ^ arr[j];
    }
  }
  cout << ans % M << endl;
}
