import sys input = sys.stdin.readline N=int(input()) E=[[] for i in range(N)] mod=998244353 for i in range(N-1): a,b=map(int,input().split()) a-=1 b-=1 E[a].append(b) E[b].append(a) ROOT=0 QUE=[ROOT] Parent=[-1]*(N+1) Parent[ROOT]=N # ROOTの親を定めておく. Child=[[] for i in range(N+1)] TOP_SORT=[] # トポロジカルソート while QUE: # トポロジカルソートと同時に親を見つける x=QUE.pop() TOP_SORT.append(x) for to in E[x]: if Parent[to]==-1: Parent[to]=x Child[x].append(to) QUE.append(to) DP1=[0]*N DP2=[0]*N for x in TOP_SORT[::-1]: if len(Child[x])==0: DP1[x]=1 DP2[x]=1 continue ARI=[] NASHI=[] ANS=1 for c in Child[x]: ARI.append(DP1[c]) NASHI.append(DP2[c]) ANS*=DP1[c]+DP2[c] ANS%=mod DP2[x]=ANS LEFT=[1]*(len(NASHI)+1) RIGHT=[1]*(len(NASHI)+1) LEFT[0]=NASHI[0]+ARI[0] for i in range(1,len(NASHI)): LEFT[i]=LEFT[i-1]*(NASHI[i]+ARI[i])%mod RIGHT[len(NASHI)-1]=NASHI[len(NASHI)-1]+ARI[len(NASHI)-1] for i in range(len(NASHI)-2,-1,-1): RIGHT[i]=RIGHT[i+1]*(NASHI[i]+ARI[i])%mod ANS=0 for i in range(len(NASHI)): if i==0: ANS+=ARI[i]*RIGHT[i+1] elif i==len(NASHI)-1: ANS+=ARI[i]*LEFT[i-1] else: ANS+=LEFT[i-1]*ARI[i]*RIGHT[i+1] ANS%=mod DP1[x]=ANS+DP2[x] print((DP1[0])%mod)