def solve():

    N = int(eval(input()))

    s = [int(eval(input())) for _ in range(N)]

    s.sort()

    ans = sum(s)



    if ans % 10 != 0:

        print(ans)

        return



    mn = float('inf')

    for i in range(N):

        if s[i] % 10 != 0:

            mn = min(mn, s[i])

    

    if mn == float('inf'):

        print((0))

    else:

        ans -= mn

        print(ans)



if __name__ == '__main__':

    solve()
def solve():

    N = int(eval(input()))

    s = [int(eval(input())) for _ in range(N)]

    sm = sum(s)

    dp = [False] * (sm + 1)

    dp[0] = True



    for val in s:

        for i in range(sm, -1, -1):

            if dp[i] and i+val <= sm:

                dp[i+val] = True

    

    for i in range(sm, -1, -1):

        if dp[i] and i % 10 != 0:

            print(i)

            return

    else:

        print((0))



if __name__ == '__main__':

    solve()
def solve():
    N = int(eval(input()))
    s = [int(eval(input())) for _ in range(N)]
    s.sort()
    ans = sum(s)
    if ans % 10 != 0:
        print(ans)
        return
    mn = float("inf")
    for i in range(N):
        if s[i] % 10 != 0:
            mn = min(mn, s[i])
    if mn == float("inf"):
        print((0))
    else:
        ans -= mn
        print(ans)


if __name__ == "__main__":
    solve()

def solve():
    N = int(eval(input()))
    s = [int(eval(input())) for _ in range(N)]
    sm = sum(s)
    dp = [False] * (sm + 1)
    dp[0] = True
    for val in s:
        for i in range(sm, -1, -1):
            if dp[i] and i + val <= sm:
                dp[i + val] = True
    for i in range(sm, -1, -1):
        if dp[i] and i % 10 != 0:
            print(i)
            return
    else:
        print((0))


if __name__ == "__main__":
    solve()

-    s.sort() -    ans = sum(s) -    if ans % 10 != 0: -        print(ans) -        return -    mn = float("inf") -    for i in range(N): -        if s[i] % 10 != 0: -            mn = min(mn, s[i]) -    if mn == float("inf"): +    sm = sum(s) +    dp = [False] * (sm + 1) +    dp[0] = True +    for val in s: +        for i in range(sm, -1, -1): +            if dp[i] and i + val <= sm: +                dp[i + val] = True +    for i in range(sm, -1, -1): +        if dp[i] and i % 10 != 0: +            print(i) +            return +    else: -    else: -        ans -= mn -        print(ans)