#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5 + 10;
const int MAXN = 1e4 + 10;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double pi = acos(-1.0);
const double eps = 1e-6;
int gcd(int a, int b) {
  int tmp;
  while (b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  int x, n, t, lst;
  cin >> n;
  vector<int> a;
  lst = 1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (gcd(x, lst) == 1)
      a.push_back(x);
    else {
      t = max(lst, x);
      while (gcd(lst, t) > 1 || gcd(t, x) > 1) --t;
      a.push_back(t);
      a.push_back(x);
    }
    lst = x;
  }
  cout << a.size() - n << endl;
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  return 0;
}
