#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr[100003];
  bool all_one = true;
  cin >> n;
  for (int i = 0; i <= n - 1; i++) {
    cin >> arr[i];
    if (arr[i] != 1) all_one = false;
  }
  sort(arr, arr + n);
  if (all_one == true) {
    for (int i = 0; i <= n - 2; i++) cout << "1 ";
    cout << "2\n";
  } else {
    for (int i = 0; i <= n - 1; i++) {
      if (i == 0)
        cout << "1";
      else
        cout << arr[i - 1];
      if (i != n - 1) cout << " ";
    }
    cout << endl;
  }
  return 0;
}
