#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 1e6 + 3;
const double pi = acos(-1.0);
const double eps = 1e-10;
int a[N];
int main() {
  int n, mx = -1, no = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (mx == -1)
      mx = a[i];
    else if (a[i] > mx) {
      mx = a[i];
      no = i;
    }
  }
  if (a[no] == 1)
    a[no] = 2;
  else
    a[no] = 1;
  sort(a, a + n);
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  return 0;
}
