#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 10, mod = 1e9 + 7;
long long a[maxn], n;
signed main() {
  ios::sync_with_stdio(false);
  cin >> 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 num[2] = {0, 0};
    for (long long j = 0; j < n; j++) ++num[(bool)(a[j] >> i & 1)];
    (ans += (num[0] * num[1]) << i) %= mod;
  }
  cout << ans;
  return 0;
}
