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