P4895 Snow Fishing Alone on a Cold River

Description

Given an unrooted tree, find the number of essentially different independent sets in it.

Input Format

The first line contains an integer $n$, the number of nodes in the tree ($n \leq 5\times 10^5$). Lines $2$ to $n$ each contain two integers $u$ and $v$, indicating that there is an edge connecting $u$ and $v$.

Output Format

Output a single integer: the number of valid ways modulo $10^9+7$.

Explanation/Hint

Translated by ChatGPT 5