#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MAXN = 1010;
int h[MAXN];
bool sign[MAXN];
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
bool ok(int a, int b) {
  int x = gcd(a, b);
  if (x == 1)
    return true;
  else
    return false;
}
int main() {
  int n;
  scanf("%d", &n);
  memset(sign, false, sizeof(sign));
  for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
  int k = 0;
  for (int i = 2; i <= n; i++) {
    if (!ok(h[i - 1], h[i])) sign[i] = true, k++;
  }
  printf("%d\n", k);
  for (int i = 1; i <= n; i++) {
    if (sign[i]) printf("1 ");
    printf("%d", h[i]);
    if (i != n) printf(" ");
  }
  printf("\n");
  return 0;
}
