#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int base = 19260817;
const long long INF = 1e18;
const int maxn = 3e5 + 10;
const double eps = 1e-8;
int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
int mul(int x, int y) { return 1LL * x * y % mod; }
vector<int> g[maxn];
int dp[maxn][3];
long long quickpow(long long a, long long x) {
  long long res = 1;
  while (x) {
    if (x & 1) res = res * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return res;
}
void dfs(int u, int pre) {
  if (g[u].size() == 1) {
    dp[u][0] = dp[u][2] = 1;
    return;
  }
  dp[u][0] = dp[u][2] = 1, dp[u][1] = 0;
  int cnt = 0;
  for (auto v : g[u]) {
    if (v == pre) continue;
    dfs(v, u);
    dp[u][0] = mul(dp[u][0], add(dp[v][0], dp[v][1]));
    dp[u][2] = mul(dp[u][2], add(dp[v][0], mul(2, dp[v][1])));
    if (!dp[v][0] && !dp[v][1]) cnt++;
  }
  if (cnt == 1) {
    dp[u][1] = 1;
    for (auto v : g[u]) {
      if (v == pre) continue;
      if (!dp[v][0] && !dp[v][1])
        dp[u][1] = mul(dp[u][1], dp[v][2]);
      else
        dp[u][1] = mul(dp[u][1], add(dp[v][0], mul(2, dp[v][1])));
    }
  } else if (!cnt) {
    for (auto v : g[u]) {
      if (v == pre) continue;
      int inv = quickpow(add(dp[v][0], mul(2, dp[v][1])), mod - 2);
      dp[u][1] = add(dp[u][1], mul(mul(dp[u][2], inv), dp[v][2]));
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v), g[v].push_back(u);
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  if (n == 2) {
    cout << 2;
    return 0;
  }
  int rt = -1;
  for (int i = 1; i <= n; i++)
    if (g[i].size() > 1) {
      rt = i;
      break;
    }
  dfs(rt, -1);
  cout << add(dp[rt][0], dp[rt][1]) << endl;
  return 0;
}
