#!/bin/python3 import sys def longestSequence(a): # Return the length of the longest possible sequence of moves. l=int(len(a)) s=0 for i in range(l): if a[i]==1: s=s+1; elif a[i]%2==0: s=s+(a[i]*2)-2 else: s=s+a[i]+1 return s if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)