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