#include <bits/stdc++.h>
using namespace std;
long long a[300010];
inline unsigned long long RD(void) {
  unsigned long long sum = 0;
  unsigned long long sign = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') {
      sign = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = sum * 10 + ch - '0';
    ch = getchar();
  }
  return sum * sign;
}
int main() {
  unsigned long long sum = 0, b, c, n, m = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = RD();
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum += (a[i] ^ a[j]) % 1000000007;
      sum %= 1000000007;
    }
  }
  cout << sum % 1000000007;
  return 0;
}
