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] = 1 dp[now][1] = 1 for to in graph[now]: if to not in s: s.add(to) dfs(to) nc = [0, 0] nc[0] = dp[now][0] * (dp[to][0] + dp[to][1]) nc[0] %= mod nc[1] = dp[now][0] * dp[to][1] + dp[now][1] * (dp[to][0] + dp[to][1]) nc[1] %= mod dp[now] = nc dfs(0) return dp[0][1] n = ii() AB = [li() for _ in range(n - 1)] print(solve(n, AB))