import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] dp = new int[n + 1][10]; Arrays.fill(dp[0], -1); dp[0][0] = 0; for (int i = 1; i <= n; i++) { int x = sc.nextInt() % 10; for (int j = 0; j < 10; j++) { dp[i][j] = dp[i - 1][j]; } for (int j = 0; j < 10; j++) { if (dp[i - 1][j] >= 0) { dp[i][(j + x) % 10] = Math.max(dp[i][(j + x) % 10], dp[i - 1][j] + 1); } } } System.out.println(dp[n][0]); } }