#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 14, mod = 998244353;
int n;
unsigned int dp[maxn][2], pre[maxn];
vector<int> g[maxn];
void dfs(int v = 0, int p = -1) {
  dp[v][0] = 1;
  for (int i = 0; i < g[v].size(); i++)
    if (g[v][i] != p) {
      dfs(g[v][i], v);
      dp[v][0] = (long long)dp[v][0] * (dp[g[v][i]][1] + dp[g[v][i]][0]) % mod;
    } else {
      swap(g[v][i], g[v].back());
      g[v].pop_back();
      i--;
    }
  pre[0] = 1;
  for (int i = 0; i < g[v].size(); i++)
    pre[i + 1] =
        (long long)pre[i] * (2 * dp[g[v][i]][1] + dp[g[v][i]][0]) % mod;
  int suf = 1;
  for (int i = g[v].size() - 1; i >= 0; i--) {
    int ch = 1;
    for (auto x : g[g[v][i]])
      ch = (long long)ch * (dp[x][0] + dp[x][1] * 2) % mod;
    dp[v][1] = (dp[v][1] + (long long)ch * suf % mod * pre[i]) % mod;
    suf = (long long)suf * (2 * dp[g[v][i]][1] + dp[g[v][i]][0]) % mod;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs();
  cout << (dp[0][0] + dp[0][1]) % mod << '\n';
}
