#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  deque<int> dq(n);
  for (int i = 0; i < n; ++i) scanf("%d", &dq[i]);
  sort(((dq).begin()), ((dq).end()));
  if (dq.back() == 1) {
    dq.pop_back();
    dq.push_back(2);
  } else {
    dq.pop_back();
    dq.push_front(1);
  }
  for (const int& i : dq) printf("%d ", i);
  cin.ignore();
  cin.get();
}
