#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  unsigned long long L;
  unsigned long long MOD = 1000000007;
  vector<bitset<60>> bs(N);
  unsigned long long result = 0;
  for (int i = 0; i < N; i++) {
    cin >> L;
    bs[i] = bitset<60>(L);
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      result = (result + (bs[i] ^ bs[j]).to_ullong()) % MOD;
    }
  }
  cout << result << endl;
  return 0;
}
