#include using namespace std; int main() { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; a[i] %= 10; } vector dp(10 , 0); for (int i = 0; i < n; i++) { vector new_dp = dp; if (dp[a[i]] == 0) new_dp[a[i]] = 1; for (int j = 0; j < 9; j++) { if (dp[j] > 0) new_dp[(j + a[i]) % 10] = max(new_dp[(j + a[i]) % 10] , dp[j] + 1); } dp = new_dp; } cout << dp[0] << endl; return 0; }