#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  int maxInd = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    if (arr[i] > arr[maxInd]) maxInd = i;
  }
  if (arr[maxInd] > 1)
    arr[maxInd] = 1;
  else
    arr[maxInd] = 2;
  sort(arr.begin(), arr.end());
  for (int i : arr) cout << i << ' ';
  cout << '\n';
}
