#include <bits/stdc++.h>
using namespace std;
const int kMod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long sum = 0;
  for (int i = 0; i <= 60; ++i) {
    long long c0 = 0;
    long long c1 = 0;
    for (auto a : A) {
      if (((a >> i) & 1LL) == 0)
        ++c0;
      else
        ++c1;
    }
    long long tmp = (1LL << i) * c0 % kMod * c1 % kMod;
    sum = (sum + tmp) % kMod;
  }
  cout << sum << endl;
  return 0;
}
