#include <bits/stdc++.h>
using namespace std;
long long a[300005], ans = 0, s;
int def = 1000000007;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      s = (a[i] xor a[j]) % def;
      ans = (ans % def + s % def) % def;
    }
  }
  printf("%lld\n", ans % def);
  return 0;
}
