#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (ll bit = 0; bit < 65; bit++) {
    ll zero = 0;
    ll one = 0;
    for (ll i = 0; i < N; i++) {
      if (A[i] & (1 << bit)) {
        one++;
      } else {
        zero++;
      }
    }
    ans += (one * zero) * (1 << bit);
    ans %= (ll)(1000000007);
  }
  cout << ans << endl;
  return 0;
}
