#include using namespace std; int INF = 10000000; int main(){ int N; cin >> N; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; A[i] %= 10; } vector> dp(N + 1, vector(10, -INF)); dp[0][0] = 0; for (int i = 0; i < N; i++){ dp[i + 1] = dp[i]; for (int j = 0; j < 10; j++){ dp[i + 1][(j + A[i]) % 10] = max(dp[i + 1][(j + A[i]) % 10], dp[i][j] + 1); } } cout << dp[N][0] << endl; }