#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
int main() {
  int N;
  ll A[300000];
  cin >> N;
  for (int i(0); i < N; i++) cin >> A[i];
  ll tmp(1);
  ll ans(0);
  for (int i(1); i <= 60; i++) {
    int cnti(0), cntz(0);
    tmp *= 2;
    for (int j(0); j < N; j++) {
      if (A[j] % 2 == 1) {
        cnti += 1;
        A[j] /= 2;
      } else {
        cntz += 1;
        A[j] /= 2;
      }
    }
    ans += cnti * cntz * tmp / 2;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
