#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto& a : A) cin >> a;
  int ans = 0;
  for (int k = 0; k < 64; k++) {
    ll m = 1ll << k;
    int c = 0;
    for (auto a : A)
      if (a & m) c++;
    ans += (m % 1000000007 * (c * (N - c))) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
