#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long M = 1e9 + 7;
const double PI = 3.14159265358;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> nums(n, 0);
  for (auto &i : nums) cin >> i;
  sort((nums).begin(), (nums).end());
  bool b = false;
  for (int i = n - 1; i >= 1; i--)
    b = b | (nums[i] != nums[i - 1]), nums[i] = nums[i - 1];
  if (nums[0] != 1)
    nums[0] = 1;
  else if (nums[n - 1] == 1 && !b)
    nums[n - 1] = 2;
  for (auto i : nums) cout << i << " ";
  return 0;
}
