#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b) {
    int tmp;
    tmp = b;
    b = a;
    a = tmp;
  }
  return b == 0 ? a : gcd(b, a % b);
}
int a[1007];
int b[1007];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (n == 1) {
    printf("0\n");
    for (int i = 1; i <= n; i++) printf("%d%c", a[i], i == n ? '\n' : ' ');
  } else {
    int cnt = 0;
    int k;
    for (int i = 2; i <= n; i++) {
      if (gcd(a[i - 1], a[i]) != 1) {
        b[i] = 1;
        cnt++;
      }
    }
    printf("%d\n", cnt);
    for (int i = 1; i <= n; i++) {
      if (b[i] == 1) printf("%d ", b[i]);
      printf("%d%c", a[i], i == n ? '\n' : ' ');
    }
  }
  return 0;
}
