#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int a[300000], sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum = ((sum % 1000000007) + ((a[i] ^ a[j]) % 1000000007)) % 1000000007;
    }
  }
  cout << sum;
}
