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