#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10, mod = 1e9 + 7;
int n;
long long a[maxn], num[70], ans;
long long qpow(long long a, long long b) {
  if (b == 0) return 1;
  long long tmp = qpow(a, b / 2);
  long long ans = tmp * tmp;
  if (b & 1) ans = ans * a % mod;
  return ans;
}
int main() {
  cin >> n;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  for (int i = (0); i <= (60); ++i) {
    long long tmp = 0;
    for (int j = 1; j <= n; j++)
      if (a[j] >> i & 1) tmp++;
    num[i] = tmp * (n - tmp) % mod;
    ans = (ans + num[i] * qpow(2, i) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
