#include <bits/stdc++.h>
using namespace std;
int power(int a, int b) {
  int answer = 1;
  while (b-- > 0) answer *= a;
  return answer;
}
int main() {
  int n;
  scanf("%d", &n);
  bool flag = true;
  int m[100000];
  for (int i = 0; i < n; i++) {
    scanf("%d", &m[i]);
    if (m[i] != 1) flag = false;
  }
  sort(m, m + n);
  if (!flag) {
    printf("1");
    for (int i = 1; i < n; i++) printf(" %d", m[i - 1]);
  } else {
    for (int i = 0; i < n; i++) {
      if (i != n - 1)
        printf("1 ");
      else
        printf("2");
    }
  }
  return 0;
}
