#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<long long> A;
int main() {
  long long N;
  cin >> N;
  long long keta = 0;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    A.push_back(a);
    if (keta < log2(a) + 1) keta = log2(a) + 1;
  }
  cout << keta << endl;
  vector<long long> one(60, 0);
  for (long long i = 0; i < N; i++) {
    long long tmp = A[i];
    for (long long j = 0; j < keta; j++) {
      if (tmp & 1) one[j]++;
      tmp >>= 1;
    }
  }
  long long ans = 0, p = 1;
  for (long long i = 0; i < keta; i++) {
    ans = (ans + (p * (one[i] * (N - one[i])) % MOD) % MOD) % MOD;
    p = (p * 2) % MOD;
  }
  cout << ans << endl;
  return 0;
}
