#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[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 if ((n - 1) == 0)
    arr[n - 1] = 1;
  else
    arr[n - 1] = arr[n - 2];
  for (int i = (n - 2); i >= 0; i--) {
    if (arr[i] == 1 && arr[i + 1] == 1)
      arr[i] = 1;
    else if (arr[i] == 1 && arr[i + 1] != 1)
      arr[i] = 1;
    else if (i == 0)
      arr[i] = 1;
    else
      arr[i] = arr[i - 1];
  }
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  return 0;
}
