#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
bool dbg = false;
int n;
vector<long long> an(300030);
long long ans = 0;
void solve() {
  for (long long i = 0; i < 61; i++) {
    long long c0 = 0;
    long long c1 = 0;
    for (int j = 0; j < n; j++) {
      if (((long long)(1ll) << (i)) & an.at(j)) {
        c1++;
      } else {
        c0++;
      }
    }
    unsigned long long tmp = (1ll << (i));
    tmp %= mod;
    ans += (c0 * c1 * tmp);
    ans %= mod;
    cerr << "2^" << i << ":" << ans << endl;
  }
  ans += mod;
  ans %= mod;
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> an.at(i);
  }
  solve();
  return 0;
}
