#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (int b = 0; b < (60); ++b) {
    long long msk = 1LL << b;
    int zero = 0, one = 0;
    for (int i = 0; i < (n); ++i) {
      if (a[i] & msk)
        one++;
      else
        zero++;
    }
    ans = (ans + (msk * (zero * one) % MOD) % MOD) % MOD;
  }
  cout << ans << endl;
}
