#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < (N); i++) cin >> A[i];
  ll ans = 0;
  vector<ll> pow2(63);
  pow2[0] = 1;
  for (int i = 0; i < (62); i++) {
    pow2[i + 1] = pow2[i] * 2;
    pow2[i + 1] %= 1000000007;
  }
  for (int i = 0; i < (62); i++) {
    vector<ll> cnt(2, 0);
    for (int j = 0; j < (N); j++) {
      cnt[A[j] % 2]++;
      A[j] >>= 1;
    }
    ll mul = cnt[0] * cnt[1];
    ans += pow2[i] * mul;
    ans %= 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
