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