#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  while (b > 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long x[2000];
int main() {
  long long n, ans = 0, t = 19999909;
  cin >> n;
  long long a[n + 5];
  a[0] = 1;
  for (long long k = 1; k <= n; k++) {
    cin >> a[k];
    if (gcd(a[k - 1], a[k]) > 1) {
      x[k - 1] = 1;
      ans++;
    }
  }
  cout << ans << endl;
  for (long long k = 1; k <= n; k++) {
    cout << a[k] << ' ';
    if (x[k] > 0) cout << x[k] << ' ';
  }
  return 0;
}
