#include <bits/stdc++.h>
long long a[300030] = {};
int main() {
  int n, i, j;
  long long sum, ans = 0;
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; i++) scanf("%lld", &a[i]);
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        sum = a[i] ^ a[j];
        ans += sum % 1000000007;
      }
    }
    ans %= 1000000007;
    printf("%d\n", ans);
    ans = 0;
  }
}
