#include using namespace std; #define N (1000000000+7) //#define N (998244353) #define INF 1e16 typedef long long ll; int dp[200010][10]; int main(void){ int n; cin>>n; vectora(n); for(int i=0;i>a[i]; a[i] = (a[i]%10); } for(int i=0;i<=n;i++){ for(int j=0;j<10;j++){ dp[i][j]=-1; } } dp[0][0]=0; for(int i=0;i