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