#include <bits/stdc++.h>
using namespace std;
int n;
long long li[300005], ans;
const long long m = 1e9 + 7;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &li[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      ans += (li[i] ^ li[j]) % m;
    }
  }
  cout << ans % m << endl;
  return 0;
}
