#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0, dgt = 1, cnt = 0;
  for (int i = 0; i < 60; i++) {
    cnt = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) cnt++;
    }
    ans += cnt * (n - cnt) * dgt % MOD;
    dgt = dgt * 2 % MOD;
  }
  cout << ans << '\n';
  return 0;
}
