Score : $200$ points
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 called Square $0$, Square $1$, Square $2$, and Square $3$. Initially, all squares are empty.
There is also an integer $P$; initially, $P = 0$.
Given 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:
Print the value of $P$ after all the operations have been performed.
Input is given from Standard Input in the following format:
$N$ $A_1$ $A_2$ $\dots$ $A_N$
Print the value of $P$ after all the operations have been performed.
4 1 1 3 2
3
The operations are described below. After all the operations have been performed, $P$ equals $3$.
3 1 1 1
0
The value of $P$ may not be updated by the operations.
10 2 2 4 1 1 1 4 2 2 1
8