#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long x;
  vector<bitset<60>> A(n);
  for (int i = 0; i < n; i++) {
    cin >> x;
    bitset<60> t(x);
    A.at(i) = t;
  }
  unsigned long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      bitset<60> s = A.at(i) ^ A.at(j);
      sum = (sum + s.to_ullong()) % 1000000007;
    }
  }
  cout << sum << endl;
}
