#include <bits/stdc++.h>
using namespace std;
int a, n, m, i, j, ans, aa, b, s[100010];
bool d[10010];
int main() {
  cin >> a;
  for (i = 1; i <= a; ++i) {
    cin >> s[i];
  }
  for (i = 2; i <= a; ++i) {
    aa = s[i];
    b = s[i - 1];
    while (b) {
      aa %= b;
      swap(aa, b);
    }
    if (aa != 1) {
      ++ans;
      d[i] = 1;
    }
  }
  cout << ans << "\n";
  for (i = 1; i <= a; ++i) {
    cout << s[i] << " ";
    if (d[i + 1] == 1) {
      cout << 1 << " ";
    }
  }
  return 0;
}
