#include <bits/stdc++.h>
using namespace std;
int A[100010];
vector<int> v;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int st;
    cin >> st;
    v.push_back(st);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  if (v[0] == 1)
    v[0] = 2;
  else
    v[0] = 1;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    cout << v[i] << " ";
  }
  return 0;
}
