#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 1e18, MOD = 1e9 + 7;
const int INT_INF = 1e9, INT_MOD = 1e9 + 7;
signed main() {
  int64_t n;
  cin >> n;
  int64_t a[n + 1];
  for (int64_t i = 0; i < n; i++) cin >> a[i];
  int64_t ans = 0, tmp2 = 1;
  int64_t xo[60];
  for (int64_t i = 0; i < 60; i++) xo[i] = 0;
  for (int64_t i = 0; i < 60; i++) {
    for (int64_t j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) xo[i]++;
    }
    ans += (tmp2 * xo[i] * (n - xo[i])) % MOD;
    ans %= MOD;
    tmp2 *= 2;
    tmp2 %= MOD;
  }
  cout << ans << endl;
  return 0;
}
