IDENTIFICATION DIVISION.
PROGRAM-ID. 164C.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(20).
01 N          PIC 9(6).
01 I          PIC 9(6).
01 TBL.
   03 S       PIC X(10) OCCURS 200000 DEPENDING ON N.
01 CNT        PIC 9(6).
01 OUT        PIC Z(5)9.
*>
PROCEDURE DIVISION.
  ACCEPT N.
*>
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    ACCEPT S(I)
  END-PERFORM.
*>
  SORT S ASCENDING KEY S.
  MOVE 1 TO CNT.
  PERFORM VARYING I FROM 2 BY 1 UNTIL I > N
    IF S(I) NOT = S(I - 1)
      ADD 1 TO CNT
    END-IF
  END-PERFORM.
*>
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.
