#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
ll modpow(ll a, ll n, ll m) {
  if (n == 0) return 1;
  ll half = modpow(a, n / 2, m);
  ll res = half * half % m;
  if (n & 1) res = res * a % m;
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<vector<int>> A(N);
  for (int i = (int)(0); i < (int)(N); i++) {
    ll a;
    cin >> a;
    while (a > 0) {
      int d = a % 2;
      A[i].push_back(d);
      a /= 2;
    }
    while (A[i].size() < 60) {
      A[i].push_back(0);
    }
  }
  ll ans = 0;
  for (int j = (int)(0); j < (int)(60); j++) {
    int cnt = 0;
    for (int i = (int)(0); i < (int)(N); i++) {
      if (A[i][j] == 1) cnt++;
    }
    ans += cnt * (N - cnt) % 1000000007 * modpow(2, j, 1000000007) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
