#include <bits/stdc++.h>
using namespace std;
struct state {
  int row, col, val;
  state(int _r, int _c, int _v) : row(_r), col(_c), val(_v) {}
  bool operator<(const state &s) const { return val > s.val; }
};
int a[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &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 (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}
