#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int mod = 1e9 + 7;
int n;
long long a[maxn], cnt2[61];
int cnt[maxn][60], sum[60];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cnt2[0] = 1;
  for (int i = 1; i < 60; i++) cnt2[i] = cnt2[i - 1] * 2 % mod;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < 60; j++) {
      cnt[i][j] = ((a[i] >> j) & 1ll);
      sum[j] += cnt[i][j];
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; ++i) {
    ans = (ans + 1ll * ((1ll << i) % mod) * sum[i] * (n - sum[i]) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
