export {}; const input = require("fs").readFileSync(0).toString().trim().split('\n'); const N: number = Number(input[0]); let graph: number[][] = Array.from({length: N+1}, () => []); for(let i=1; i new Array(2).fill(0)); const dfs = (n: number) => { visited[n] = true; dp[n][0] = 1; for(let nxt of graph[n]) { if(visited[nxt]) continue; dfs(nxt); dp[n][1] += dp[nxt][0]; dp[n][0] += Math.min(dp[nxt][0], dp[nxt][1]); } }; dfs(1); console.log(Math.min(dp[1][0], dp[1][1]));