Jumping Machine

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Young inventor has created a new jumping machine. In order to test it, he brought it to the testing polygon. The polygon is an infinite square grid.

Initially, the machine is located in the cell (0,0)(0, 0). The machine has nn springs, the ii-th spring has the force of l_il\_i and allows the machine to jump l_il\_i cells up or l_il\_i cells to the right. Therefore this spring allows the machine to get from cell (x,y)(x, y) either to cell (x+l_i,y)(x + l\_i, y), or to cell (x,y+l_i)(x, y + l\_i). After jumping, the spring is thrown back and cannot be reused. The machine can use the springs in any order.

During the tests the cells, that the machine will fly over, will be stained with machine oil. In order not to clean the grid after himself, the inventor has decided to put a protective mat on each cell the machine could potentially fly over.

Now the inventor is wondering how many protective mats he needs to bring to the test with him.

입력

The first line of input contains nn --- the number of springs that the machine has (1n1001 \le n \le 100). The second line contains nn integers l_il\_i --- the springs forces (l_i1l\_i \ge 1; 1l_1+l_2++l_n1061 \le l\_1 + l\_2 + \dots + l\_n \le {10}^6).

출력

Output a single integer: the number of mats that inventor needs to bring.

힌트

All the cells that can get dirty when the machine jumps in the example test are colored orange one the figure below.

Cells that the machine can stain.