#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n = 0;
  int hm = 0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < v.size() - 1; i++) {
    if (gcd(v[i], v[i + 1]) != 1) {
      hm++;
      v.insert(v.begin() + i + 1, 1);
    } else
      continue;
  }
  cout << hm << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
