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