#include <bits/stdc++.h>
using namespace std;
const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(DOUBLE_ACCURACY);
  void solve();
  if (DO_BENCHMARK) {
    clock_t clock_start = clock();
    solve();
    clock_t clock_end = clock();
    const double time =
        static_cast<double>(clock_end - clock_start) / CLOCKS_PER_SEC * 1000.0;
    cout << "\n" << time << "[ms]\n";
  } else
    solve();
}
void solve() {
  long long int N;
  cin >> N;
  vector<bitset<62>> vecbit(N);
  for (int i = 0; i < N; i++) {
    long long int dummy;
    cin >> dummy;
    vecbit[i] = dummy;
  }
  long long int ans = 0;
  for (int i = 0; i < 62; i++) {
    int tbit = 0;
    int fbit = 0;
    for (int j = 0; j < N; j++) {
      if (vecbit[j][i]) {
        tbit++;
      } else {
        fbit++;
      }
    }
    ans += (long long int(pow(2, i)) % MOD * (tbit * fbit) % MOD) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << "\n";
}
