#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000009;
const int MAXN = 1000 * 1000;
const int MOD = 998244353;
int n;
vector<int> graph[MAXN + 3];
long long dp[MAXN + 3][3];
void Dfs(int v, int parent) {
  dp[v][2] = 1;
  for (auto u : graph[v]) {
    if (u == parent) continue;
    Dfs(u, v);
    long long tmp[3];
    for (int i = 0; i <= 2; i++)
      tmp[i] = dp[v][i] * (dp[u][0] + dp[u][2]) % MOD;
    tmp[0] = (tmp[0] + (dp[v][1] + dp[v][2]) * (dp[u][1] + dp[u][2])) % MOD;
    tmp[0] = (tmp[0] + dp[v][0] * dp[u][0]) % MOD;
    tmp[1] = (tmp[1] + (dp[v][1] + dp[v][2]) * dp[u][0]) % MOD;
    for (int i = 0; i <= 2; i++) dp[v][i] = tmp[i];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  Dfs(1, 0);
  printf("%lld\n", (dp[1][0] + dp[1][2]) % MOD);
  return 0;
}
