#include <bits/stdc++.h>
long long mod = 1000000007;
using namespace std;
int main() {
  long long n;
  scanf("%lld", &n);
  long long a[n + 10];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 1; i <= n - 1; i++) {
    for (long long j = i + 1; j <= n; j++) {
      ans += (a[i] ^ a[j]) % mod;
    }
  }
  cout << ans % mod << endl;
  return 0;
}
