#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long solve() {
  long long n, ans = 0;
  cin >> n;
  long long pw[65];
  pw[0] = 1;
  for (long long i = 1; i <= 60; i++) pw[i] = (pw[i - 1] * 2) % mod;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long j = 0; j <= 60; j++) {
    long long s = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] % 2) s++;
      a[i] /= 2;
    }
    ans = (ans + (((s * (n - s)) % mod) * pw[j]) % mod) % mod;
  }
  cout << ans;
  return 0;
}
signed main() {
  ios::sync_with_stdio(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
