#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
ll two[62];
string binary(ll bina) {
  string ans;
  for (ll i = 0; bina > 0; i++) {
    ans = ans + to_string((bina % 2));
    bina = bina / 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  for (ll i = 0; i < 62; i++) {
    two[i] = 0;
  }
  ll N;
  cin >> N;
  ll kazu[N];
  for (ll i = 0; i < N; i++) {
    cin >> kazu[i];
  }
  for (ll i = 0; i < N; i++) {
    string tow = binary(kazu[i]);
    for (ll k = 0; k < tow.size(); k++) {
      if (tow.at(k) == '1') {
        two[k] += 1;
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 62; i++) {
    ll temp = pow(2, i);
    ans += (N - two[i]) * two[i] % MOD * temp % MOD;
    ans = ans % MOD;
  }
  cout << ans << endl;
  return 0;
}
