#include #include #include using namespace std; const size_t MAX_N = 100100; const long long MOD = 998244353; vector edge[MAX_N]; using Pll = pair; // {connect, disconnect} Pll dfs(int now, int prv = -1) { // {must, can, cannot} connect with parent long long dp[3] = {1, 0, 0}; for(auto &child : edge[now]) { if(child == prv) continue; auto dp_sub = dfs(child, now); for(int i = 2; 0 <= i; i--) { dp[i] *= dp_sub.second; if(i > 0) dp[i] += dp[i-1] * dp_sub.first; dp[i] %= MOD; } } return {dp[0] + dp[1], dp[1] + dp[2]}; } int main() { int n; cin >> n; for(int i = 0; i < n-1; i++) { int u, v; cin >> u >> v; --u; --v; edge[u].emplace_back(v); edge[v].emplace_back(u); } cout << dfs(0).second % MOD << endl; }