#include <bits/stdc++.h>
using namespace std;
const long int mod = 1000 * 1000 * 1000 + 7;
int main() {
  int n;
  cin >> n;
  vector<unsigned long long int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  unsigned long long int sum = 0;
  unsigned long long int now_sum = 0;
  for (int i = 0; i < n - 1; i++) {
    now_sum = 0;
    for (int j = i + 1; j < n; j++) {
      now_sum += a[i] ^ a[j];
      now_sum %= mod;
    }
    sum += now_sum;
    sum %= mod;
  }
  cout << sum;
}
