#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, w[300005], ans;
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> w[i];
  sort(w + 1, w + n + 1);
  for (long long i = 0; i <= 59; i++) {
    long long cnt = 0;
    for (long long j = 1; j <= n; j++)
      if ((w[j] >> i) & 1) cnt++;
    ans = (ans + (1LL << i) * cnt * (n - cnt)) % mod;
  }
  cout << ans % mod << endl;
  return 0;
}
