IDENTIFICATION DIVISION.
PROGRAM-ID. 124B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP PIC X(80).
01 N   PIC 9(2).
01 I   PIC 9(2).
01 CNT PIC 9(2).
01 H   PIC 9(3).
01 MAX PIC 9(3).
01 P1  PIC 9(2).
01 P2  PIC 9(2).
01 OUT PIC Z9.
*>
PROCEDURE DIVISION.
  ACCEPT N.
  ACCEPT INP.
  MOVE 0 TO CNT MAX.
  MOVE 1 TO P1.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    PERFORM VARYING P2 FROM P1 BY 1 UNTIL INP(P2:1) = ' '
    END-PERFORM
    MOVE INP(P1:P2 - P1) TO H
    IF (H >= MAX)
      ADD 1 TO CNT
    END-IF
    IF (H > MAX)
      MOVE H TO MAX
    END-IF
    COMPUTE P1 = P2 + 1
  END-PERFORM.
*>
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
*>
  STOP RUN.
