PROGRAM-ID.                      ABC_046_A.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(11).
    01 a       PIC 9(3).
    01 b       PIC 9(3).
    01 c       PIC 9(3).
    01 cnt1.
        03 cnt PIC 9(3) OCCURS 100 VALUE ZERO.
    01 i       PIC 9(3).
    01 sm      PIC 9(1).
    01 ans     PIC X(1).

    01 ZS      PIC Z(2).
    01 DUMMY   PIC X(1).

PROCEDURE                        DIVISION.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO a b c.

    ADD 1 TO cnt(a).
    ADD 1 TO cnt(b).
    ADD 1 TO cnt(c).

    PERFORM VARYING i FROM 1 BY 1 UNTIL 100 < i
        IF ZERO < cnt(i) THEN
            ADD 1 TO sm
        END-IF
    END-PERFORM.

    MOVE sm TO ZS
    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.
