#include <bits/stdc++.h>
template <class T>
void read(T &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  x = f ? -x : x;
  return;
}
const int maxn = 3e5 + 7, P = 998244353;
struct node {
  int v, next;
} e[maxn << 1];
int cnt, head[maxn];
long long f[maxn][3], tmp[3];
void ins(int u, int v) {
  e[++cnt].v = v;
  e[cnt].next = head[u];
  head[u] = cnt;
}
void dfs(int x, int fa) {
  f[x][0] = 1;
  for (int p = head[x]; p; p = e[p].next) {
    int v = e[p].v;
    if (v == fa) continue;
    dfs(v, x);
    tmp[0] = f[x][0] * (f[v][0] + f[v][2]) % P;
    tmp[1] =
        (f[x][0] * f[v][2] % P + f[x][1] * (f[v][0] + f[v][2] * 2) % P) % P;
    tmp[2] =
        (f[x][0] * (f[v][1] + f[v][0]) % P + f[x][1] * (f[v][0] + f[v][1]) % P +
         f[x][2] * (f[v][0] + f[v][2] * 2) % P) %
        P;
    std::swap(tmp, f[x]);
  }
}
int main() {
  int n;
  read(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    read(u);
    read(v);
    ins(u, v);
    ins(v, u);
  }
  dfs(1, 0);
  printf("%lld\n", (f[1][0] + f[1][2]) % P);
  return 0;
}
