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