#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5 + 10;
int n;
int arr[MN];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  sort(arr, arr + n);
  if (arr[n - 1] == 1)
    arr[n - 1] = 2;
  else
    arr[n - 1] = 1;
  sort(arr, arr + n);
  for (int i = 0; i < n; ++i) cout << arr[i] << ' ';
  cout << endl;
  return 0;
}
