Which change repairs the damaged-item counter?

An algorithm is a step-by-step procedure for carrying out a task. The algorithm below should count all damaged items in a finite list. Every item’s Damage Status is Yes or No. For an empty list, the required count is 0.

The draft below is incorrect. For the statuses Yes, No, Yes, it outputs 1 although the required count is 2.

The steps use pseudocode, a way to describe instructions with words and structured lines. Input names the information supplied; Output names the result to report. You can follow the steps by hand.

Input: Returned Items with Damage Status (Yes/No)
Output: Damaged Count
Start
   For each Item in Returned Items
      Set Damaged Count to 0
      If Damage Status of Item is Yes
         Set Damaged Count to Damaged Count + 1
      End If
   End For
   Output Damaged Count
End

Which single change makes the algorithm correct for every permitted list? Leave all other instructions unchanged.

  1. Move Set Damaged Count to 0 inside the If, immediately before adding 1.
  2. Move Set Damaged Count to 0 after End For, immediately before the output.
  3. Change Damaged Count + 1 to Damaged Count + 2.
  4. Move Set Damaged Count to 0 immediately after Start, before For each.