#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  vector<long long int> v1;
  vector<long long int> v2;
  long long int n, mo = 0, x, y, f;
  scanf("%lld", &n);
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &f);
    v1.push_back(f);
  }
  for (long long int i = 0; i < n; ++i) {
    v2.push_back(v1[i]);
    if (i + 1 == n) break;
    x = v1[i], y = v1[i + 1];
    if (x < y) swap(x, y);
    if (gcd(x, y) != 1) {
      mo++;
      v2.push_back(1);
    }
  }
  printf("%lld\n", mo);
  for (long long int i = 0; i < v2.size(); ++i) printf("%lld ", v2[i]);
  printf("\n");
  return 0;
}
