#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e6 + 3;
const long long INF = 2e9;
const long long N = 1e6 + 2;
const long long MAX = 2e5 + 2;
const long double EPS = 1e-8;
int a[N], b[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  if (a[n - 1] != 1)
    a[n - 1] = 1;
  else
    a[n - 1] = 2;
  sort(a, a + n);
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
}
