#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() {
  long long i, cnt = 0, n, x, gcd_, ar[1000];
  scanf("%lld", &n);
  vector<long long> v;
  for (i = 0; i < n; i++) {
    scanf("%lld", &ar[i]);
  }
  for (i = 1; i < n; i++) {
    v.push_back(ar[i - 1]);
    gcd_ = gcd(ar[i], ar[i - 1]);
    if (gcd_ != 1) {
      cnt++;
      v.push_back(1);
    }
  }
  v.push_back(ar[n - 1]);
  printf("%lld\n", cnt);
  for (i = 0; i < v.size(); i++) printf("%lld ", v[i]);
  printf("\n");
}
