#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  ll mod = 1e9 + 7;
  vector<ll> b(60);
  for (int i = (0); i < (n); i++) {
    ll a;
    cin >> a;
    for (int j = (0); j < (60); j++)
      if (a & (1LL << j)) b[j]++;
  }
  ll ans = 0;
  for (int i = (0); i < (60); i++)
    ans = (ans + (1LL << i) % mod * b[i] * (n - b[i])) % mod;
  cout << ans << endl;
  return 0;
}
