source_code: import java.io.*;
  import java.util.*;
  
  public class A {
  
      BufferedReader br;
      PrintWriter out;
      StringTokenizer st;
      boolean eof;
  
      void solve() throws IOException {
          int n = nextInt();
          int[] a = new int[n];
  
          boolean onlyOnes = true;
  
          for (int i = 0; i < n; i++) {
              a[i] = nextInt();
              if (a[i] != 1)
                  onlyOnes = false;
          }
  
          Arrays.sort(a);
          if (onlyOnes) {
              for (int i = 0; i < n - 1; i++)
                  out.print("1 ");
              out.print(2);
          } else {
              out.print("1 ");
              for (int i = 0; i < n - 1; i++)
                  out.print(a[i] + " ");
          }
  
      }
  
      void inp() throws IOException {
          br = new BufferedReader(new InputStreamReader(System.in));
          out = new PrintWriter(System.out);
          solve();
          out.close();
      }
  
      public static void main(String[] args) throws IOException {
          new A().inp();
      }
  
      String nextToken() {
          while (st == null || !st.hasMoreTokens()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (Exception e) {
                  eof = true;
                  return "0";
              }
          }
          return st.nextToken();
      }
  
      String nextString() {
          while (st == null || !st.hasMoreTokens()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (Exception e) {
                  eof = true;
                  return "0";
              }
          }
          return st.nextToken("\n");
      }
  
      int nextInt() throws IOException {
          return Integer.parseInt(nextToken());
      }
  
      long nextLong() throws IOException {
          return Long.parseLong(nextToken());
      }
  
      double nextDouble() throws IOException {
          return Double.parseDouble(nextToken());
      }
  
  }
  