/** * @FileName b.cpp * @Author kanpurin * @Created 2020.09.18 21:52:23 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; constexpr int INF = 1e9 + 6; vector> dp(n+1,vector(10,-INF)); dp[0][0] = 0; for (int i = 0; i < n; i++) { int a;cin >> a; for (int j = 0; j < 10; j++) { dp[i + 1][(j + a) % 10] = dp[i][(j + a) % 10]; if (dp[i][j] == -INF) continue; dp[i + 1][(j + a) % 10] = max(dp[i + 1][(j + a) % 10],dp[i][j] + 1); } } cout << dp[n][0] << endl; return 0; }