import sys from collections import deque, Counter sys.setrecursionlimit(5 * 10 ** 5) from pypyjit import set_param set_param('max_unroll_recursion=-1') input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 def solve(n, AB): dp = [[0] * 2 for _ in range(n)] s = set() graph = [[] for _ in range(n)] for a, b in AB: graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) s.add(0) def dfs(now): dp[now][0] = dp[now][1] = 1 des = [] for to in graph[now]: if to not in s: des.append(to) s.add(to) dfs(to) for to in des: dp[now][0] *= (dp[to][0] + dp[to][1]) dp[now][0] %= mod P = dp[now][0] dp[now][1] = P frprod = [1] backprod = [1] for to in des: frprod.append(frprod[-1] * (dp[to][0] + dp[to][1]) % mod) for to in des[::-1]: backprod.append(backprod[-1] * (dp[to][0] + dp[to][1]) % mod) for i, to in enumerate(des): dp[now][1] += (dp[to][1] * frprod[i] % mod) * backprod[len(des) - i - 1] % mod dp[now][1] %= mod dfs(0) return dp[0][1] n = ii() AB = [li() for _ in range(n - 1)] print(solve(n, AB))