#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int ii = 0; ii < N; ++ii) {
    cin >> A[ii];
  }
  long long ans = 0;
  for (long long keta = 0; keta < 61; ++keta) {
    long long n0 = 0;
    long long n1 = 0;
    for (int ii = 0; ii < N; ++ii) {
      if (A[ii] & 1) {
        n1++;
      } else {
        n0++;
      }
      A[ii] /= 2;
    }
    long long base = (1LL << keta) % MOD;
    ans = (ans + n0 * n1 * base) % MOD;
  }
  cout << ans << "\n";
  return 0;
}
