#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  vector<ll> vec;
  int n;
  ll mod = 1e9 + 7LL;
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll x;
    cin >> x;
    vec.push_back(x);
  }
  ll ans = 0;
  ll powmod[62];
  powmod[0] = 1;
  for (int i = 1; i <= 60; i++) {
    powmod[i] = (powmod[i - 1] * 2) % mod;
  }
  for (int i = 0; i < 60; i++) {
    ll z = 0, o = 0;
    for (int j = 0; j < n; j++) {
      if (((vec[j] >> i) & 1) == 1) {
        o++;
      } else
        z++;
    }
    ans = (ans + (o * (z * powmod[i]) % mod)) % mod;
  }
  cout << ans << endl;
}
