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