#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long mxn = 3e5 + 10, md = 998244353;
long long n, v, u;
long long dp[mxn][3], par[mxn];
vector<long long> G[mxn];
bool mark[mxn];
long long tav(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long x = tav(a, b / 2);
  x = x * x % md;
  if (b % 2 == 1) {
    return x * a % md;
  }
  return x;
}
void DFS(int x) {
  mark[x] = 1;
  if (G[x].size() == 1 && x != 1) {
    dp[x][0] = 1, dp[x][1] = 0, dp[x][2] = 1;
    return;
  }
  for (auto a : G[x]) {
    if (!mark[a]) {
      par[a] = x;
      DFS(a);
      dp[x][0] *= (2 * dp[a][1] + dp[a][2]);
      dp[x][0] %= md;
    }
  }
  for (auto a : G[x]) {
    if (a != par[x]) {
      dp[x][1] += (dp[x][0] * tav(2 * dp[a][1] + dp[a][2], md - 2) % md *
                   dp[a][0] % md);
      dp[x][2] *= (dp[a][1] + dp[a][2]);
      dp[x][1] %= md, dp[x][2] %= md;
    }
  }
}
void input() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> v >> u;
    G[v].push_back(u);
    G[u].push_back(v);
  }
}
void solve() {
  for (int i = 0; i < mxn; i++) {
    dp[i][2] = dp[i][0] = 1;
  }
  par[1] = 1;
  DFS(1);
  cout << (dp[1][1] + dp[1][2]) % md << endl;
}
int main() {
  ios::sync_with_stdio(false);
  input(), solve();
  return 0;
}
