#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  vector<long long> cnt(61, 0);
  for (long long i = 0; i < 60; ++i) {
    long long cnt0 = 0LL, cnt1 = 0LL;
    for (long long j = 0; j < n; ++j) {
      if (a[j] & (1LL << i))
        cnt1++;
      else
        cnt0++;
    }
    cnt[i] = cnt0 * cnt1 % MOD;
  }
  long long yumiko = 0;
  for (long long i = 0; i < 60; ++i)
    yumiko = (yumiko + (cnt[i] * (1LL << i)) % MOD) % MOD;
  cout << yumiko << "\n";
}
