fun main() { val n = readInt() val adj = Array(n) { mutableListOf() } for (i in 0 until n - 1) { val edge = readInts() val v1 = edge[0] - 1 val v2 = edge[1] - 1 adj[v1].add(v2) adj[v2].add(v1) } val mod = 998244353L val dp = Array(n) { LongArray(3) { 0 } } fun dfs(v: Int, par: Int) { var p = 1L var s = 0L var t = 0L for (w in adj[v]) { if (w != par) { dfs(w, v) t = (t * (dp[w][1] + dp[w][2]) + s * (dp[w][0] + dp[w][1])) % mod s = (s * (dp[w][1] + dp[w][2]) + p * (dp[w][0] + dp[w][1])) % mod p *= dp[w][1] + dp[w][2] p %= mod } } dp[v][0] = p dp[v][1] = s dp[v][2] = t } dfs(0, -1) println((dp[0][1] + dp[0][2]) % mod) } fun readInt() = readln().toInt() fun readInts() = readln().split(" ").map { it.toInt() }