#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mlpow(ll x, ll p) {
  ll tmp = 1;
  if (p == 0) return 1;
  while (p != 0) {
    if (p & 1) tmp = tmp * x % 1000000007;
    x = x * x % 1000000007;
    p = p >> 1;
  }
  return tmp;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) cin >> A[i];
  ll ans = 0;
  int cnt = 0;
  bool flag = true;
  while (flag) {
    flag = false;
    int num1 = 0, num0 = 0;
    for (ll i = 0; i < N; i++) {
      if (A[i] & 1 == 1)
        num1++;
      else
        num0++;
      A[i] >>= 1;
      if (A[i] != 0) flag = true;
    }
    ll tmp = (mlpow(2, cnt) * ((num0 * num1) % 1000000007)) % 1000000007;
    ans += tmp;
    ans %= 1000000007;
    cnt++;
  }
  cout << ans << "\n";
  return 0;
}
