#include <bits/stdc++.h>
using namespace std;
vector<long long> zh[300001];
long long n, f[300001][3], g[3], p = 998244353;
void dfs(long long x, long long fa) {
  long long i, v;
  f[x][0] = 1;
  for (i = 0; i < zh[x].size(); i++) {
    if (zh[x][i] == fa) continue;
    dfs(zh[x][i], x);
    v = zh[x][i];
    g[0] = (f[x][0] * (f[v][0] + f[v][2])) % p;
    g[1] = (f[x][0] * f[v][2] + f[x][1] * (f[v][0] + f[v][2] * 2)) % p;
    g[2] = (f[x][0] * (f[v][0] + f[v][1]) + f[x][1] * (f[v][0] + f[v][1]) +
            f[x][2] * (f[v][0] + f[v][2] * 2)) %
           p;
    swap(g, f[x]);
  }
}
int main() {
  long long i, t, k;
  scanf("%lld", &n);
  for (i = 1; i < n; i++) {
    scanf("%lld%lld", &t, &k);
    zh[t].push_back(k);
    zh[k].push_back(t);
  }
  dfs(1, 0);
  printf("%lld", (f[1][0] + f[1][2]) % p);
}
