#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, mod = 998244353;
int n, dp[N][3], g[3];
vector<int> G[N];
void dfs(int x, int fa) {
  dp[x][0] = 1;
  for (auto it : G[x])
    if (it != fa) {
      dfs(it, x);
      g[0] = 1ll * dp[x][0] * (dp[it][0] + dp[it][2]) % mod;
      g[1] = (1ll * dp[x][0] * dp[it][2] +
              1ll * dp[x][1] * (dp[it][0] + 1ll * dp[it][2] * 2) % mod) %
             mod;
      g[2] = (1ll * dp[x][0] * (dp[it][0] + dp[it][1]) % mod +
              1ll * dp[x][1] * (dp[it][0] + dp[it][1]) % mod +
              1ll * dp[x][2] * (dp[it][0] + 1ll * dp[it][2] * 2) % mod) %
             mod;
      swap(dp[x], g);
    }
}
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1, x, y; i < n; i++)
    cin >> x >> y, G[x].push_back(y), G[y].push_back(x);
  dfs(1, 0);
  cout << (dp[1][0] + dp[1][2]) % mod;
  return 0;
}
