#include <bits/stdc++.h>
using namespace std;
int a[100100], n, maxi = 0;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (a[maxi] < a[i]) maxi = i;
  }
  if (a[maxi] != 1)
    a[maxi] = 1;
  else
    a[maxi] = 2;
  sort(a, a + n);
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  return 0;
}
