#include <bits/stdc++.h>
using namespace std;
int hcf(int hi, int lo) {
  int rem = hi % lo;
  if (lo == 1) return 1;
  while (rem != 0) {
    hi = lo;
    lo = rem;
    rem = hi % lo;
  }
  return lo;
}
int main() {
  int n, a[1005];
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    int hi = max(a[i], a[i + 1]);
    int lo = min(a[i], a[i + 1]);
    int h = hcf(hi, lo);
    if (h > 1) {
      v.push_back(a[i]);
      v.push_back(1);
    } else
      v.push_back(a[i]);
  }
  v.push_back(a[n - 1]);
  cout << v.size() - n << "\n";
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
}
