#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
const int Mod = 998244353;
long long f[N][3];
vector<int> G[N];
void dfs(int v, int p = -1) {
  for (auto u : G[v]) {
    if (u == p) continue;
    dfs(u, v);
  }
  f[v][1] = 1;
  f[v][2] = 0;
  f[v][0] = 1;
  long long factor = 1;
  for (auto u : G[v]) {
    if (u == p) continue;
    f[v][1] = (f[u][2] + f[u][0]) * f[v][1] % Mod;
    f[v][0] = f[u][0] * f[v][0] % Mod;
    f[u][1] = factor * f[u][1] % Mod;
    factor = factor * (f[u][2] + f[u][0]) % Mod;
  }
  factor = 1;
  for (int i = G[v].size() - 1; i >= 0; i--) {
    int u = G[v][i];
    if (u == p) continue;
    f[u][1] = factor * f[u][1] % Mod;
    factor = factor * (f[u][2] + f[u][0]) % Mod;
  }
  for (auto u : G[v]) {
    if (u == p) continue;
    f[v][2] = (f[v][2] + f[u][1]) % Mod;
  }
  f[v][0] = (f[v][0] + f[v][2]) % Mod;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1);
  printf("%lld\n", f[1][0]);
}
