题目描述
Problem Description
Takahashi's secretary, Nagisa, loves him very much. Therefore, it is certain that Takahashi also loves Nagisa very much. To confirm this, she decided to perform a flower picking ritual using the flowers in the garden.
"Like", "Dislike", "Like", "Dislike", "Like", "Dislike"…
This is strange. Takahashi should love Nagisa, but the result of the flower picking was "Dislike". This must be because the flowers are bad.
Nagisa ordered the servants to pluck the petals so that the result of the flower picking would not be "Dislike".
Nagisa's flower picking has two patterns. One is to alternately say "Like" and "Dislike" while plucking one petal at a time. The other is to repeat "Like", "Dislike", "Love very much" while plucking one petal at a time.
In either pattern, the last word said becomes the result of the flower picking.
As Nagisa's servant, you need to pluck the petals in advance so that the result is not "Dislike" regardless of which pattern she uses.
Given the number of flowers in the garden and the number of petals on each flower, output the number of petals that need to be plucked.
Input Format
The input is given from the standard input in the following format:
$ n $ $ a_1 $ $ a_2 $ ... $ a_n $
- The first line contains an integer $n\ (1\ ≦\ n\ ≦\ 10)$ representing the number of flowers in the garden.
- The second line contains information about the number of petals on each flower, separated by spaces. The number of petals on the $ i $th flower is given by the integer $a_i\ (1\ ≦\ a_i\ ≦\ 9)$ provided in the $ i $th position.
Output Format
Output the number of petals that need to be plucked in one line. Include a newline at the end of the output.
Sample Input and Output
Sample Input #1
3
5 8 2
Sample Output #1
4
Sample Input #2
9
1 2 3 4 5 6 7 8 9
Sample Output #2
8
Notes/Hints
Sample Explanation 1
Focusing on the first flower:
- With 5 petals, the second pattern of flower picking results in "Like", "Dislike", "Love very much", "Like", "Dislike", which is "Dislike", so petals need to be plucked.
- With 4 petals, the first pattern results in "Like", "Dislike", "Like", "Dislike", which is "Dislike", so petals need to be plucked.
- With 3 petals, the first pattern results in "Like", the second pattern results in "Love very much", so no petals need to be plucked.
Similarly, the flower with 8 petals can be reduced to 7 petals, and the flower with 2 petals can be reduced to 1 petal to prevent the result from being "Dislike". The total number of petals that need to be plucked is $2\ +\ 1\ +\ 1\ =\ 4$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分