#include <bits/stdc++.h>
using namespace std;
using VP = vector<pair<long long, long long> >;
using VVP = vector<VP>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const long long INF = 1LL << 58;
const long long mod = 1e9 + 7;
int main() {
  long long i, j;
  long long n;
  cin >> n;
  long long a[n];
  long long ans = 0;
  for (i = 0; i < n; i++) cin >> a[i];
  vector<long long> v(60, 0);
  for (j = 0; j < 60; j++) {
    for (i = 0; i < n; i++) v[j] += ((a[i] >> j) & 1) == 1;
  }
  for (i = 0; i < 60; i++) {
    ans = ans + ((1 << i) % mod) * (v[i] * (n - v[i]) % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
