using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long aa = 0; for (int i=0;i <= a.Length - 1; i++) { if (a[i] % 2 == 0) { aa += ((a[i] * 2) - 2); } else if (a[i]==1) { aa += 1; } else { aa += a[i] + 1; } } return aa; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); long[] a = Array.ConvertAll(a_temp,Int64.Parse); long result = longestSequence(a); Console.WriteLine(result); } }