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