#include <bits/stdc++.h>
using namespace std;
int n, m, k, cnt, ans, sum, x, y;
string s, s1, a, b, c;
vector<int> v;
set<int> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  int arr[n];
  int arr1[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    arr1[i] = arr[i];
  }
  sort(arr, arr + n);
  if (arr[n - 1] == 1)
    arr[n - 1] = 2;
  else
    arr[n - 1] = 1;
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
}
