#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n;
long long a[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  if (a[n] != 1)
    a[n] = 1;
  else
    a[n] = 2;
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) cout << a[i] << " ";
}
