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