{"problem":{"name":"Batters","description":{"content":"> Takahashi is trying to create a game inspired by baseball, but he is having difficulty writing the code.   > Write a program for Takahashi that solves the following problem. There are $4$ squares c","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc256_b"},"statements":[{"statement_type":"Markdown","content":"> Takahashi is trying to create a game inspired by baseball, but he is having difficulty writing the code.  \n> Write a program for Takahashi that solves the following problem.\n\nThere are $4$ squares called Square $0$, Square $1$, Square $2$, and Square $3$. Initially, all squares are empty.  \nThere is also an integer $P$; initially, $P = 0$.  \nGiven a sequence of positive integers $A = (A_1, A_2, \\dots, A_N)$, perform the following operations for $i = 1, 2, \\dots, N$ in this order:\n\n1.  Put a piece on Square $0$.\n2.  Advance every piece on the squares $A_i$ squares ahead. In other words, if Square $x$ has a piece, move the piece to Square $(x + A_i)$.  \n    If, however, the destination square does not exist (i.e. $x + A_i$ is greater than or equal to $4$) for a piece, remove it. Add to $P$ the number of pieces that have been removed.\n\nPrint the value of $P$ after all the operations have been performed.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   $1 \\leq A_i \\leq 4$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\dots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc256_b","tags":[],"sample_group":[["4\n1 1 3 2","3\n\nThe operations are described below. After all the operations have been performed, $P$ equals $3$.\n\n*   The operations for $i=1$:\n    1.  Put a piece on Square $0$. Now, Square $0$ has a piece.\n    2.  Advance every piece on the squares $1$ square ahead. After these moves, Square $1$ has a piece.\n*   The operations for $i=2$:\n    1.  Put a piece on Square $0$. Now, Squares $0$ and $1$ have a piece.\n    2.  Advance every piece on the squares $1$ square ahead. After these moves, Squares $1$ and $2$ have a piece.\n*   The operations for $i=3$:\n    1.  Put a piece on Square $0$. Now, Squares $0$, $1$, and $2$ have a piece.\n    2.  Advance every piece on the squares $3$ squares ahead.  \n        Here, for the pieces on Squares $1$ and $2$, the destination squares do not exist (since $1+3=4$ and $2+3=5$), so remove these pieces and add $2$ to $P$. $P$ now equals $2$. After these moves, Square $3$ has a piece.\n*   The operations for $i=4$:\n    1.  Put a piece on Square $0$. Now, Squares $0$ and $3$ have a piece.\n    2.  Advance every piece on the squares $2$ squares ahead.  \n        Here, for the piece on Square $3$, the destination square does not exist (since $3+2=5$), so remove this piece and add $1$ to $P$. $P$ now equals $3$.  \n        After these moves, Square $2$ has a piece."],["3\n1 1 1","0\n\nThe value of $P$ may not be updated by the operations."],["10\n2 2 4 1 1 1 4 2 2 1","8"]],"created_at":"2026-03-03 11:01:14"}}