#include <bits/stdc++.h>
using namespace std;
long int gcd(long int n1, long int n2) {
  return (n2 == 0) ? n1 : gcd(n2, n1 % n2);
}
int main() {
  int n, i = 0;
  long int temp;
  vector<long int> arr1, arr2;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> temp;
    arr1.push_back(temp);
  }
  arr2.push_back(arr1[0]);
  for (i = 0; i < n - 1; i++) {
    if (gcd(arr1[i], arr1[i + 1]) == 1) {
      arr2.push_back(arr1[i + 1]);
    } else {
      arr2.push_back(1);
      arr2.push_back(arr1[i + 1]);
    }
  }
  cout << arr2.size() - arr1.size() << endl;
  for (i = 0; i < arr2.size(); i++) {
    cout << arr2[i] << " ";
  }
  return 0;
}
