#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long ans = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= 60; i++) {
    long long t = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i)) t++;
    }
    ans = (ans + (1LL << i) % 1000000007 * t * (n - t)) % 1000000007;
  }
  cout << ans << endl;
}
