#include <bits/stdc++.h>
using namespace std;
template <typename input_type>
input_type get() {
  input_type input;
  cin >> input;
  return input;
}
const int max_sz = 3e5 + 5, mod = 998244353, useless = 3;
int sz;
long long int dp[max_sz][useless];
vector<int> nghbr[max_sz];
inline void add_edge(pair<int, int> endpnt) {
  nghbr[endpnt.first].push_back(endpnt.second);
  nghbr[endpnt.second].push_back(endpnt.first);
}
inline void dfs(int vrtx, int prnt = -1) {
  long long int tmp[useless];
  dp[vrtx][0] = 1;
  for (auto ngh : nghbr[vrtx]) {
    if (ngh != prnt) {
      dfs(ngh, vrtx);
      tmp[0] = (dp[vrtx][0] * (dp[ngh][0] + dp[ngh][2])) % mod;
      tmp[1] = (((dp[vrtx][0] * dp[ngh][2]) % mod) +
                (dp[vrtx][1] * (dp[ngh][0] + 2 * dp[ngh][2]) % mod)) %
               mod;
      tmp[2] =
          (((dp[vrtx][0] + dp[vrtx][1]) * (dp[ngh][0] + dp[ngh][1]) % mod) +
           (dp[vrtx][2] * (dp[ngh][0] + 2 * dp[ngh][2]) % mod)) %
          mod;
      for (int i = 0; i < useless; i++) {
        dp[vrtx][i] = tmp[i];
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sz = get<int>();
  for (int i = 0; i < (sz - 1); i++) {
    add_edge({get<int>() - 1, get<int>() - 1});
  }
  dfs(0);
  cout << (dp[0][0] + dp[0][2]) % mod;
  return 0;
}
