#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  sort(a, a + n);
  if (a[n - 1] == 1) {
    a[n - 1] = 2;
  } else
    a[n - 1] = 1;
  sort(a, a + n);
  for (int i = 0; i < (int)n; ++i) {
    if (i) cout << " ";
    cout << a[i];
  }
  cout << endl;
}
