#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll a;
  vll one(62);
  for (int i = 0; i < n; i++) {
    cin >> a;
    ll d = 0;
    while (a) {
      one[d++] += (a & 1LL);
      a >>= 1;
    }
  }
  ll res = 0, k = 1;
  for (int i = 0; i < 62; i++) {
    res += k * one[i] * (n - one[i]);
    res %= MOD;
    k = (2 * k) % MOD;
  }
  cout << res << endl;
  return 0;
}
