#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (!x) return y;
  return gcd(y % x, x);
}
int main() {
  long long n, x;
  list<long long> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  list<long long>::iterator it1, it2;
  long long counter = 0;
  for (it1 = v.begin(); it1 != v.end(); it1++) {
    it2 = it1;
    it2++;
    if (it2 != v.end() && gcd(min(*it1, *it2), max(*it1, *it2)) != 1) {
      v.insert(it2, 1);
      counter++;
    }
  }
  cout << counter << endl;
  for (it1 = v.begin(); it1 != v.end(); it1++) cout << *it1 << " ";
  cout << endl;
  return 0;
}
