#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
long long dp[300005][3];
vector<int> v[300005];
long long f_pow(long long a, long long b) {
  long long res = 1, temp = a;
  while (b) {
    if (b & 1) res = res * temp % mod;
    temp = temp * temp % mod;
    b >>= 1;
  }
  return res;
}
void dfs(int first, int f) {
  long long sum1 = 1, sum2 = 1, sum3 = 1;
  int zero, cnt = 0;
  for (auto it : v[first]) {
    if (it != f) {
      dfs(it, first);
      if ((dp[it][0] * 2 + dp[it][1]) % mod == 0) {
        cnt++;
        zero = it;
      } else {
        sum1 *= (dp[it][0] * 2 + dp[it][1]) % mod;
        sum1 %= mod;
      }
      sum2 *= (dp[it][0] + dp[it][1]) % mod;
      sum2 %= mod;
      sum3 *= (dp[it][0] * 2 + dp[it][1]) % mod;
      sum3 %= mod;
    }
  }
  dp[first][0] = 0;
  dp[first][1] = sum2;
  dp[first][2] = sum3;
  if (cnt == 2) return;
  for (auto it : v[first]) {
    if (it != f) {
      if (cnt == 1 && zero != it) continue;
      if (!cnt)
        dp[first][0] += dp[it][2] * sum1 % mod *
                        f_pow(dp[it][1] + dp[it][0] * 2, mod - 2) % mod;
      else
        dp[first][0] += dp[it][2] * sum1 % mod;
      dp[first][0] %= mod;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int first, second;
    scanf("%d %d", &first, &second);
    v[first].push_back(second);
    v[second].push_back(first);
  }
  dfs(1, 0);
  printf("%lld\n", (dp[1][0] + dp[1][1]) % mod);
}
