#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<int> array(N);
  for (int i = 0; i < N; ++i) std::cin >> array[i];
  std::sort(array.begin(), array.end());
  if (1 == array.back())
    array[N - 1] = 2;
  else
    array[N - 1] = 1;
  std::sort(array.begin(), array.end());
  for (int i = 0; i < N; ++i) std::cout << array[i] << " ";
  return 0;
}
