#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  vector<bitset<60>> bit(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    bitset<60> a(A[i]);
    bit[i] = a;
  }
  vector<long long> count1(60, 0);
  vector<long long> count0(60, 0);
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < N; j++) {
      if (bit[j][i])
        count1[i]++;
      else
        count0[i]++;
    }
  }
  long long sum = 0;
  for (long long i = 0; i < 60; i++) {
    long long b = (1LL << i);
    cout << b << endl;
    sum += count0[i] * count1[i] * b;
  }
  cout << sum % 1000000007 << endl;
}
