#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
const int N = 310000;
const int mod = 1e9 + 7;
ull arr[N];
int main() {
  int n;
  ull sum = 0;
  cin >> n;
  for (int i = (0); i < (n); ++i) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (arr[i] ^ arr[j]) % mod;
    }
  }
  cout << sum % mod;
  return 0;
}
