#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)1e6 + 6, mod = (long long)998244353;
long long dp[N][3];
vector<long long> adj[N];
void dfs(long long v, long long p = -1) {
  long long par_pos = 0;
  long long m = (long long)adj[v].size();
  for (long long j = 0; j < m; ++j)
    if (adj[v][j] == p) par_pos = j;
  for (long long u : adj[v])
    if (u != p) dfs(u, v);
  vector<long long> ls(m + 1), rs(m + 1);
  ls[0] = 1;
  rs[m - 1] = 1;
  long long cnt = 0;
  vector<long long> ch;
  for (long long u : adj[v])
    if (u != p) {
      ls[cnt + 1] = (long long)ls[cnt] * (dp[u][0] + dp[u][2]) % mod;
      ++cnt;
      ch.push_back(u);
    }
  cnt = m - 1;
  for (long long j = m - 1; j >= 0; --j)
    if (adj[v][j] != p) {
      long long u = adj[v][j];
      rs[cnt - 1] = ((long long)rs[cnt] * (dp[u][1] + dp[u][0]) % mod);
      --cnt;
    }
  dp[v][2] = ls[par_pos] * (long long)rs[par_pos] % mod;
  {
    for (long long j = 0; j < par_pos; ++j) {
      dp[v][0] =
          (dp[v][0] + (long long)ls[j] * rs[j + 1] % mod * dp[ch[j]][1]) % mod;
    }
  }
  {
    for (long long j = par_pos; j < m - 1; ++j) {
      dp[v][1] =
          (dp[v][1] + (long long)ls[j] * rs[j + 1] % mod * dp[ch[j]][1]) % mod;
    }
    dp[v][1] = (dp[v][1] + (long long)ls[m - 1]) % mod;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  adj[n - 1].push_back(-1);
  for (long long j = 0; j < n - 1; ++j) {
    long long u, v;
    cin >> u >> v;
    --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(n - 1);
  cout << dp[n - 1][1] % mod << endl;
}
