#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using _loop_ll = long long;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  vl a(N);
  for (_loop_ll(i) = 0; (i) < (_loop_ll)(N); (i)++) cin >> a.at(i);
  ll res = 0;
  for (_loop_ll(b) = 0; (b) < (_loop_ll)(60); (b)++) {
    ll sum = 0;
    for (_loop_ll(i) = 0; (i) < (_loop_ll)(N); (i)++) {
      sum += (a.at(i) % 2);
      a.at(i) >>= 1;
    }
    res = (res + (1 << b) * sum * (N - sum)) % MOD;
    cerr << "res"
         << ": " << (res) << endl;
  }
  cout << res << endl;
  return 0;
};
