#include <bits/stdc++.h>
using namespace std;
int n, a[111111];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  a[0] = 1;
  sort(a + 1, a + n + 1);
  if (a[n] == 1) a[n - 1] = 2;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
