#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) {
  if (a == 0) {
    return b;
  }
  return GCD(b % a, a);
}
const int maxn = 1005;
int a[maxn];
int main() {
  int n, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i >= 1 && GCD(a[i], a[i - 1]) != 1) {
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n - 1; i++) {
    if (GCD(a[i], a[i + 1]) != 1) {
      cout << a[i] << " " << 1 << " ";
    } else {
      cout << a[i] << " ";
    }
  }
  cout << a[n - 1];
  return 0;
}
