#include <bits/stdc++.h>
using namespace std;
int myRnd() { return abs(((rand() << 15) ^ rand())); }
int myRnd(int L, int R) {
  return abs(((rand() << 15) ^ rand())) % (R - L + 1) + L;
}
void Parr(int *arr, int L, int R) {
  for (int i = L; R >= i; i++) {
    printf("%d%c", arr[i], " \n"[i == R]);
  }
}
void Pvec(vector<int> v) {
  for (int i = 0; ((int)(v).size()) > i; i++) {
    printf("%d%c", v[i], " \n"[i == ((int)(v).size()) - 1]);
  }
}
void Sarr(int *arr, int L, int R) {
  for (int i = L; R >= i; i++) {
    scanf("%d", &(arr[i]));
    ;
  }
}
const int N = 2e5 + 6;
int a[N];
int b[N];
int main() {
  srand(time(NULL));
  int n;
  scanf("%d", &(n));
  ;
  Sarr(a, 1, n);
  sort(a + 1, a + n + 1);
  for (int i = 1; (n) >= i; ++i) {
    b[i] = max(1, a[i - 1]);
  }
  bool jizz = true;
  for (int i = 1; (n) >= i; ++i) {
    jizz &= (a[i] == 1);
  }
  if (jizz) b[n] = 2;
  Parr(b, 1, n);
}
