#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto &it : A) cin >> it;
  ll ans = 0;
  for (int d = 0; d < 60; d++) {
    ll n0 = 0, n1 = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] >> d) & 1)
        n1++;
      else
        n0++;
    }
    ll tmp = (1LL << d) % MOD;
    ll n = n0 * n1 % MOD;
    tmp *= n % MOD;
    ans += tmp % MOD;
  }
  cout << ans << endl;
  return 0;
}
