#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
bool coY() { cout << "Yes" << endl; }
bool coN() { cout << "No" << endl; }
const ll INF = 1LL << 60;
ll n, m;
string s;
const int mod = 1e9 + 7;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin >> n;
  vector<ll> a(n);
  for (int i = (0); i < (n); ++i) cin >> a[i];
  vector<ll> nishin(62, 0);
  bitset<62> b;
  for (int i = (0); i < (n); ++i) {
    b = a[i];
    for (int j = 0; j < 62; j++) {
      if (b.test(j)) {
        nishin[j]++;
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < 62; i++) {
    ll iti = nishin[i];
    ll zero = n - iti;
    ll tmp = iti * zero;
    ans += tmp * modpow(2, i, mod);
  }
  cout << ans % mod << endl;
}
