#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int n;
vector<int> ans;
int main() {
  cin >> n;
  int p = 1;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (gcd(p, x) > 1) {
      ans.push_back(1);
    }
    ans.push_back(x);
    p = x;
  }
  cout << ans.size() - n << endl;
  for (auto x : ans) {
    cout << x << " ";
  }
  return 0;
}
