#include <bits/stdc++.h>
using namespace std;
vector<int> son[500005];
long long ksm(long long x, long long y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % 998244353)
    if (y & 1) ret = ret * x % 998244353;
  return ret;
}
int tmp[500005], cnt;
long long f1[500005], f2[500005], dp[500005][4];
void dfs(int now, int fat) {
  int T, i, g = 1, j;
  for (i = 0; i < son[now].size(); ++i)
    if ((T = son[now][i]) != fat) dfs(T, now);
  for (cnt = i = 0; i < son[now].size(); ++i)
    if ((T = son[now][i]) != fat) tmp[++cnt] = T;
  f1[0] = f2[cnt + 1] = 1;
  for (i = 1; i <= cnt; ++i)
    f1[i] = f1[i - 1] * (dp[tmp[i]][1] + dp[tmp[i]][3]) % 998244353;
  for (i = cnt; i; --i)
    f2[i] =
        f2[i + 1] * (dp[tmp[i]][0] + dp[tmp[i]][1] + dp[tmp[i]][2]) % 998244353;
  dp[now][0] = f1[cnt];
  for (i = 0, j = 1; i < son[now].size(); ++i) {
    if ((T = son[now][i]) == fat) {
      dp[now][g = 3] = f1[j - 1] * f2[j] % 998244353;
    } else {
      if (g == 1)
        (dp[now][1] += f1[j - 1] * f2[j + 1] % 998244353 *
                       (dp[T][2] + dp[T][0])) %= 998244353;
      else
        (dp[now][2] += f1[j - 1] * f2[j + 1] % 998244353 *
                       (dp[T][2] + dp[T][0])) %= 998244353;
      ++j;
    }
  }
}
int n, i, x, y;
int main() {
  for (ios::sync_with_stdio(false), cin >> n, i = 1; i < n; ++i)
    cin >> x >> y, son[x].push_back(y), son[y].push_back(x);
  dfs(1, 0), cout << (dp[1][0] + dp[1][1]) % 998244353 << "\n";
}
