#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long int arr[N];
vector<int> vc;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, mini = 1e9;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mini = min(mini, arr[i]);
  }
  sort(arr, arr + n);
  if (arr[n - 1] == 1) {
    for (int i = 0; i < n - 1; i++) cout << 1 << " ";
    cout << 2 << " ";
    return 0;
  }
  cout << 1 << " ";
  for (int i = 1; i < n; i++) cout << arr[i - 1] << " ";
}
