#include <bits/stdc++.h>
using namespace std;
int 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 i = 0; i < 60; i++) {
    long long cnt = 0;
    for (long long o = 0; o < n; o++) {
      if (a[o] & (1ll << i)) {
        cnt++;
      }
    }
    ans = (ans + (cnt * (n - cnt) * (1ll << i)) % 1000000007) % 1000000007;
  }
  cout << ans;
}
