#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long bit = 0; bit < 63; bit++) {
    long long set = 0, unset = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] & 1)
        set++;
      else
        unset++;
      a[i] >>= 1;
    }
    ans += (set * unset * ((1ll << bit) % 1000000007)) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << "\n";
}
