#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  if (n == 1) {
    if (arr[0] == 1)
      cout << 2;
    else
      cout << 1;
    return 0;
  }
  sort(arr, arr + n);
  for (long long int i = 0; i < n; i++) {
    if (i == 0)
      cout << 1 << " ";
    else {
      if (i == n - 1) {
        if (arr[i] == 1)
          cout << 2 << " ";
        else {
          cout << arr[i - 1] << " ";
        }
      } else {
        cout << arr[i - 1] << " ";
      }
    }
  }
  return 0;
}
