#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const string sp = " ";
void run();
void init() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
}
signed main() {
  init();
  run();
  return 0;
}
void run() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long c = 0;
    for (long long j = 0; j < n; j++) c += (a[j] >> i) & 1;
    ans = (ans + c * (n - c) % mod * (1ll << i) % mod) % mod;
  }
  cout << ans << endl;
}
