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