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