import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto N = lread();
    auto S = new long[](N);
    foreach (i; 0 .. N)
    {
        auto s = lread();
        S[i] = s;
    }
    // writeln(S);
    if (func(S))
    {
        writeln(0);
        return;
    }
    long sum_S = sum(S);
    // writeln(sum_S);
    // S.sort().writeln();
    S.sort();
    if (sum_S % 10 == 0)
    {
        sum_S -= func2(S);
    }
    writeln(sum_S);

}
//全部10の倍数
bool func(long[] S)
{
    foreach (i; 0 .. (S.length))
    {
        if (S[i] % 10 == 0)
        {
            continue;
        }
        else
        {
            return false;
        }
    }
    return true;
}
//sort(S)の中で一番小さいS[i]%10!=0
long func2(long[] S)
{
    foreach (i; 0 .. (S.length))
    {
        if (S[i] % 10 != 0)
        {
            return S[i];
        }
    }
    return 0;
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
