#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll RepeatSquare(ll x, ll y, ll mod) {
  if (y == 0) return 1;
  if (y % 2 == 0) {
    ll h = RepeatSquare(x, y / 2, mod);
    return h * h % mod;
  }
  if (y % 2 == 1) return x * RepeatSquare(x, y - 1, mod);
}
int main() {
  ll n;
  cin >> n;
  vector<int> flags(65);
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < 60; j++) {
      if (a == 0) break;
      if (a % 2 == 1) flags.at(j)++;
      a /= 2;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ans += flags.at(i) * (n - flags.at(i)) * RepeatSquare(2, i, 1000000007) %
           1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
