#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
bool isCoprime(int a, int b) { return gcd(a, b) == 1; }
int prime(int a, int b) {
  int res = 2;
  while (!(isCoprime(res, a) && isCoprime(res, b))) res++;
  return res;
}
int n, k = 0;
vector<int> a, b;
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    b.push_back(a[i]);
    if (!isCoprime(a[i], a[i + 1])) {
      b.push_back(prime(a[i], a[i + 1]));
      k++;
    }
  }
  b.push_back(a.back());
  cout << k << endl;
  for (int i = 0; i < n + k; i++) cout << b[i] << ' ';
  return 0;
}
