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