#include <bits/stdc++.h>
using namespace std;
const int INT_INF = 1e9;
const long long INF = 1LL << 30;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  long long two = 1;
  for (long long i = 0; i < 60; i++) {
    int zero = 0, one = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i))
        one++;
      else
        zero++;
    }
    (ans += (zero * one) % MOD * two % MOD) %= MOD;
    (two *= 2) %= MOD;
  }
  cout << ans << endl;
}
