N = int(input()) H = list(map(int,input().split())) iwai = "g"*200000 for i in range(N): if iwai[0] == "g": iwai = iwai[:H[i]].replace("g","b") + iwai[H[i]:] else: iwai = iwai[:H[i]].replace("b","g") + iwai[H[i]:] print(iwai.count("b"))