#include <bits/stdc++.h>
const int N = 100010;
const int inf = 0x3f3f3f3f;
using namespace std;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int mx = 0;
  for (int i = 0; i < n; i++) mx = max(a[i], mx);
  for (int i = 0; i < n; i++)
    if (a[i] == mx) {
      a[i] = mx == 1 ? 2 : 1;
      break;
    }
  sort(a, a + n);
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  puts("");
  return 0;
}
