#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int a[1005];
vector<int> ans;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  ans.push_back(a[1]);
  for (int i = 2; i <= n; i++) {
    if (gcd(a[i], a[i - 1]) == 1) {
      ans.push_back(a[i]);
      continue;
    }
    ans.push_back(1);
    ans.push_back(a[i]);
  }
  printf("%d\n", ans.size() - n);
  for (int i = 0; i < ans.size() - 1; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[ans.size() - 1]);
  return 0;
}
