#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int inf = 1000 * 1000 * 1000;
const double eps = 1e-10;
int main() {
  vector<int> ar;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    ar.push_back(t);
  }
  sort(ar.begin(), ar.end());
  if (ar[n - 1] == 1)
    ar[n - 1] = 2;
  else
    ar[n - 1] = 1;
  sort(ar.begin(), ar.end());
  for (int i = 0; i < n; i++) {
    printf("%d ", ar[i]);
  }
  return 0;
}
