#include <bits/stdc++.h>
using namespace std;
long long N;
vector<long long> a;
int main() {
  cin >> N;
  a = vector<long long>(N);
  for (long long i = 0; i < N; ++i) cin >> a.at(i);
  vector<long long> o;
  long long MOD = 1000000000 + 7;
  for (long long b = 0; b < 60; ++b) {
    long long count = 0;
    long long x = 1LL << b;
    for (long long i = 0; i < N; ++i) {
      if ((a.at(i) & x) == 0) ++count;
    }
    o.push_back(count);
  }
  long long sum = 0;
  for (long long b = 0; b < 60; ++b) {
    sum += (o.at(b) * (N - o.at(b))) * (1LL << b);
    sum = sum % MOD;
  }
  sum = sum % MOD;
  cout << sum << endl;
}
