#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%ld", &a[i]);
  auto p = max_element(a.begin(), a.end());
  if (*p == 1)
    *p = 2;
  else
    *p = 1;
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
