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