#include <bits/stdc++.h>
long long n, a[300005], s = 0, mod = 1000000007, dp[100] = {0};
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long cnt = 0, t = a[i];
    while (t) {
      cnt++;
      if (t % 2) dp[cnt]++;
      t /= 2;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 61; i++)
    ans = (ans % mod +
           ((long long)(1 << i) * dp[i + 1] * (n - dp[i + 1])) % mod) %
          mod;
  cout << ans;
  return 0;
}
