#include <bits/stdc++.h>
using namespace std;
long long K = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  long long Ans = 0;
  int Cou = 0;
  while (A.at(N - 1) > 0) {
    int COU = 0;
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2) {
        COU++;
      }
      A.at(i) /= 2;
    }
    Ans += COU * (N - COU) * pow(2, Cou);
    Ans %= K;
    Cou++;
    sort(A.begin(), A.end());
  }
  cout << Ans;
}
