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 CalcDepth(s, graph): INF = 2 ** 63 - 1 from collections import deque n = len(graph) depth = [INF] * n depth[s] = 0 q = deque() q.append(s) while q: now = q.popleft() for to in graph[now]: if depth[to] == INF: depth[to] = depth[now] + 1 q.append(to) return depth 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) d = CalcDepth(0, graph) l = list(range(n)) l.sort(key = lambda x: d[x], reverse=True) for now in l: dp[now][0] = 1 dp[now][1] = 1 s.add(now) for to in graph[now]: if to in s: 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 return dp[0][1] n = ii() AB = [li() for _ in range(n - 1)] print(solve(n, AB))