/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君と青木君は N 曲の唱歌を歌います。 i 曲目の歌詞は A_i 行あります。
どの曲も、高橋君が 1 行目を歌い、青木君が 2 行目を歌い、高橋君が 3 行目を歌い、…と 1 行ずつ交互に歌います。
N 曲のうち、最後の行を高橋君が歌う曲の数を求めてください。
制約
- 1 \leq N \leq 100
- 1 \leq A_i \leq 1000
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \ldots A_N
- 1 行目には、曲の数 N が与えられる。
- 2 行目には、各曲の歌詞の行数 A_1, A_2, \ldots, A_N がスペース区切りで与えられる。
出力
最後の行を高橋君が歌う曲の数を 1 行で出力せよ。
入力例 1
4 3 4 7 10
出力例 1
2
入力例 2
1 1
出力例 2
1
入力例 3
3 2 2 2
出力例 3
0
入力例 4
18 518 72 971 121 862 967 606 138 754 513 337 499 873 337 387 647 100 76
出力例 4
10
入力例 5
7 130 623 701 180 63 216 91
出力例 5
4
Score : 200 pts
Problem Statement
Takahashi and Aoki will sing N school songs. The lyrics of the i-th song consist of A_i lines.
For every song, Takahashi sings the 1st line, Aoki sings the 2nd line, Takahashi sings the 3rd line, and so on — they alternate, singing one line each.
Among the N songs, find the number of songs whose last line is sung by Takahashi.
Constraints
- 1 \leq N \leq 100
- 1 \leq A_i \leq 1000
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N A_1 A_2 \ldots A_N
- The first line contains the number of songs N.
- The second line contains the number of lyric lines A_1, A_2, \ldots, A_N for each song, separated by spaces.
Output
Print, in one line, the number of songs whose last line is sung by Takahashi.
Sample Input 1
4 3 4 7 10
Sample Output 1
2
Sample Input 2
1 1
Sample Output 2
1
Sample Input 3
3 2 2 2
Sample Output 3
0
Sample Input 4
18 518 72 971 121 862 967 606 138 754 513 337 499 873 337 387 647 100 76
Sample Output 4
10
Sample Input 5
7 130 623 701 180 63 216 91
Sample Output 5
4