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