/*
    なせば大抵なんとかなる！
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <functional>
#define LLU unsigned long long int
#define LL long long int
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vpd vector<pair<int,int>>
#define vLL vector<long long int>
#define vpLL vector<pair<long long int,long long int>>
#define vLLU vector<unsigned long long int>
#define vpLLU vector<pair<unsigned long long int,unsigned long long int>>
#define pd pair<int,int>
#define pLL pair<long long int,long long int>
#define pLLU pair<unsigned long long int,unsigned long long int>
#define qd queue<int>
#define qpd queue<pair<int,int>>
#define maxpqd priority_queue<int>
#define minpqd priority_queue<int, vector<int>, greater<int>>
#define fr front
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forineq(a,b,c) for(int a=b ; a<=c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)
#define UPC(oo) (oo>='A' && oo<='Z')
#define LWC(oo) (oo>='a' && oo<='z')
#define DGT(oo) (oo>='0' && oo<='9')
#define UPCVOC(oo) (oo=='A' || oo=='E' || oo=='I' || oo=='U' || oo=='O')
#define LWCVOC(oo) (oo=='a' || oo=='e' || oo=='i' || oo=='u' || oo=='o')

inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void sctlld(LL &a,LL &b,LL &c){scanf("%I64d %I64d %I64d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}
inline void scllu(LLU &a){scanf("%I64",&a);}
inline void scdllu(LLU &a,LLU &b){scanf("%I64u %I64u",&a,&b);}
inline void sctllu(LLU &a,LLU &b,LLU &c){scanf("%I64u %I64u %I64u",&a,&b,&c);}

inline void prd(int a){printf("%d",a);};
inline void prdd(int a,int b){printf("%d %d",a,b);};
inline void prtd(int a, int b, int c){printf("%d %d %d",a,b,c);};
inline void prtlld(LL a, LL b, LL c){printf("%I64d %I64d %I64d",a,b,c);};
inline void prdlld(LL a, LL b){printf("%I64d %I64d",a,b);};
inline void prlld(LL a){printf("%I64d",a);};
inline void prllu(LLU a){printf("%I64u",a);};
inline void prdllu(LLU a, LLU b){printf("%I64u %I64u",a,b);};
inline void prtllu(LLU a, LLU b, LLU c){printf("%I64u %I64u %I64u",a,b,c);};

inline void debug(){printf("asd\n");}
inline void debugd(int a){printf("--- %d\n",a);};
inline void debugdd(int a,int b){printf("--- %d %d\n",a,b);};
inline void debugtd(int a, int b, int c){printf("--- %d %d %d\n",a,b,c);};
inline void debugtlld(LL a, LL b, LL c){printf("--- %I64d %I64d %I64d\n",a,b,c);};
inline void debugdlld(LL a, LL b){printf("--- %I64d %I64d\n",a,b);};
inline void debuglld(LL a){printf("--- %I64d\n",a);};
inline void debugllu(LLU a){printf("--- %I64u\n",a);};
inline void debugdllu(LLU a, LLU b){printf("--- %I64u %I64u\n",a,b);};
inline void debugtllu(LLU a, LLU b, LLU c){printf("--- %I64u %I64u %I64u\n",a,b,c);};

#define grav 9.8
#define pi 3.14159265

void st()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

bool cmp(int a,int b)
{
	return a>b;
}

int main()
{
	int a[200000];
	int n;
	scd(n);
	int d=0,ver=0,niy=0;
	forin(i,0,n)
	{
		scd(a[i]);
		d+=a[i];
		if(a[i]%10==0)
		niy++;
	}
	if(niy==n)
	{
		prd(0);
		return 0;
	}
	if(d%10==0)
	{
		d=0;
	}
	else
	{
		prd(d);
		return 0;
	}
	sort(a,a+n,cmp);
	int idx=0;
	forin(i,0,n)
	{
		idx=i;
		if((d+a[i])%10!=0)
		d+=a[i];
		else
		{
			ver=d;
			forin(j,i,n)
			{
				ver+=a[j];
				//debugd(ver);
				if(ver%10!=0)
				{
					d=ver;
					idx=j;
					//debugdd(d,idx);
					break;
				}
			}
		}
		i=idx;
	}
	prd(d);
	
	return 0;
}


Measured memory_bytes: 256