#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long bp(long long a, long long b) {
  if (b == 0) return 1;
  long long val = bp(a, b / 2);
  if (b % 2) return (((val * val) % mod) * a) % mod;
  return (val * val) % mod;
}
long long obr(long long a) { return bp(a, mod - 2); }
void solve() {
  long long n;
  cin >> n;
  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 cnt = 0;
    for (long long j = 0; j < n; ++j)
      if (a[j] & (1ll << i)) ++cnt;
    ans = (ans + ((cnt * (n - cnt)) % mod) * (1ll << i)) % mod;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
