#include <bits/stdc++.h>
using namespace std;
const int SIZE = 128;
long long INF = 1000000001;
int main() {
  int n;
  while (cin >> n) {
    vector<long long> vec;
    long long c, mini = -1, id = 0;
    for (int i = 0; i < n; i++) {
      cin >> c;
      vec.push_back(c);
    }
    for (int i = 0; i < vec.size(); i++) {
      if (mini < vec[i]) {
        mini = vec[i];
        id = i;
      }
    }
    if (mini == 1)
      vec[id] = 2;
    else
      vec[id] = 1;
    sort(vec.begin(), vec.end());
    for (int i = 0; i < vec.size(); i++) {
      if (i != 0) cout << " ";
      cout << vec[i];
    }
    cout << endl;
  }
}
