#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  int n, j = 0, c = 0;
  long long a1[10001], a2[10001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a1[i];
    if (i != 0 && gcd(a1[i], a1[i - 1]) != 1) {
      a2[j++] = 1;
      c++;
    }
    a2[j++] = a1[i];
  }
  cout << c << endl;
  for (int i = 0; i < j; i++) {
    cout << a2[i] << " ";
  }
  cout << endl;
  return 0;
}
