#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  for (long long k = 0; k < 60; k++) {
    long long num = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & (1ll << k)) num++;
    }
    long long coef = num * (N - num) % MOD;
    long long res = coef * (1ll << k) % MOD;
    ans = (ans + res) % MOD;
  }
  cout << ans << endl;
  return 0;
}
