#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int n;
  cin >> n;
  long long int MOD = 1e9 + 7;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0ll, p = 1ll;
  for (long long int i = 0; i < 60; i++) {
    long long int ones = 0ll, zero = 0ll;
    for (long long int x : a) {
      if (x & (1ll << i))
        ones++;
      else
        zero++;
    }
    ans = (ans % MOD + ((ones * zero * p) % MOD)) % MOD;
    p = (p * 2ll) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << endl;
}
