#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  int ind, mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if (A[i] > mx) {
      mx = A[i];
      ind = i;
    }
  }
  if (mx == 1)
    A[ind] = 2;
  else
    A[ind] = 1;
  sort(A, A + n);
  for (int i = 0; i < n; i++) cout << A[i] << " ";
  return 0;
}
