#include <bits/stdc++.h>
using namespace std;
vector<long long> bitconversion(long long i, long long n, long long N) {
  long long x = 1;
  for (int j = 0; j < (int)(N); j++) {
    x *= n;
  }
  vector<long long> vec(N);
  for (int j = 0; j < (int)(N); j++) {
    x /= n;
    vec[j] = i / x;
    i -= x * vec[j];
  }
  return vec;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> vec(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> vec[i];
  }
  vector<vector<long long> > bit60(N, vector<long long>(60));
  for (int i = 0; i < (int)(N); i++) {
    vector<long long> binary = bitconversion(vec[i], 2, 60);
    for (int j = 0; j < (int)(60); j++) {
      bit60[i][j] = binary[j];
    }
  }
  long long ans = 0;
  long long num = 1;
  for (int i = 59; i >= 0; i--) {
    long long count_0 = 0;
    for (int j = 0; j < (int)(N); j++) {
      if (bit60[j][i] == 0) count_0++;
    }
    ans += ((num % 1000000007) * (((N - count_0) * count_0) % 1000000007)) %
           1000000007;
    num *= 2;
    ans = ans % 1000000007;
  }
  for (int i = 0; i < (int)(N); i++) {
    for (int j = 0; j < (int)(60); j++) {
      cout << bit60[i][j];
    }
    cout << endl;
  }
  cout << ans << endl;
}
