mylist = [] n = int(input()) for i in range(1, n+1): val = int(input()) if val: mylist.append(val) # 入力した結果を表示 sumi = sum(mylist) print(sumi)