#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  bool check = true;
  if (v[n - 1] != 1)
    v[n - 1] = 1;
  else
    v[n - 1] = 2;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) cout << v[i] << " ";
  return 0;
}
