#P11863. Tree Edge Covering

    ID: 13964 Type: Default 1000ms 256MiB

Tree Edge Covering

Tree Edge Covering

Given a tree with n nodes numbered from 1 to n and rooted at node 1, you want to choose a subset of nodes (possibly empty or all) such that, when performing the following two operations for every selected node u, every edge in the tree is covered exactly once.

For each selected node u you perform two operations:

  1. Operation 1: Cover every edge in the subtree rooted at u (i.e. all edges whose both endpoints lie in the subtree with root u). Note that if u is a leaf, no edge is covered in this step.
  2. Operation 2: Cover every edge on the unique path from node u to the root (if u is the root, no edge is covered in this step).

An edge (u,v) (where u is the parent of v) is covered by a node in one of the following disjoint manners:

  • If some node on the path from the root to u (including u itself) is selected then Operation 1 of that node covers edge (u,v).
  • If no node on the path from the root to u is selected, then the only option to cover edge (u,v) is by Operation 2 of some node in the subtree of v (i.e. a node in the subtree rooted at v must be selected).

In other words, for every edge (u,v) (with u being the parent of v) the following equation must hold:

$$\Bigl(\sum_{w\in P(u)} x_w\Bigr) + \Bigl(\sum_{w\in T(v)} x_w\Bigr)=1, $$

where P(u) denotes the set of nodes on the unique path from the root to u (including u) and T(v) denotes the set of nodes in the subtree rooted at v. Here, xw is the indicator of whether node w is selected. It can be shown that along the unique root-to-leaf paths, the cumulative count of selected nodes is always either 0 or 1. In fact, if a selected node appears on a path then none of the nodes in its descendant part can be selected; and if no node is selected on a path up to some node then every edge from that node to its children forces a selection in the corresponding subtree.

Your task is to compute, modulo 998244353, the number of ways to choose a subset of nodes satisfying the above condition (two subsets are considered different if there is at least one node that is chosen in one subset and not in the other).

Input

The input is given in the following format:

 n
 u1 v1
 u2 v2
 ...
 un-1 vn-1

Here, n (1 ≤ n ≤ 2×105) is the number of nodes, and each of the next n – 1 lines contains two integers indicating an edge of the tree. It is guaranteed that the given graph is a tree and the root is node 1.

Output

Output one integer, the number of valid subsets modulo 998244353.

inputFormat

The first line contains an integer n — the number of nodes in the tree.

Each of the following n – 1 lines contains two integers u and v which represent an edge between nodes u and v.

outputFormat

Output a single integer — the number of valid ways to select nodes so that every edge is covered exactly once. Print the answer modulo 998244353.

sample

1
2