#include #include #define rep(i,a,b) for(int i=a;i=0;i--) #define rbit(i,a) for(int i=0;i<(1<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b; const ll mod=998244353; //const ll mod=1e9+7; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; const string zton="0123456789"; const string atoz="abcdefghijklmnopqrstuvwxyz"; ll gcd(ll a,ll b){ ll r; r=a%b; if(r==0){ return b; } else{ return gcd(b,r); } } typedef pair P; vector G[101010]; int N; ll dp[101010][2]; void dfs(int cu,int pa){ bool f=false; for(int to:G[cu])if(pa!=to){ dfs(to,cu); dp[cu][0]+=dp[to][0]+dp[to][1]; f=true; dp[cu][0]%=mod; if(pa!=0&&cu!=0){ dp[cu][1]+=dp[to][0]+dp[to][1]; dp[cu][1]%=mod; } } if(cu!=0&&pa!=0){ dp[cu][1]+=dp[cu][0]; dp[cu][1]%=mod; } if(f){ dp[cu][0]=(dp[cu][0]-1+mod)%mod; } return ; } int main(void){ cin >> N; rep(i,1,N){ int p;cin >> p; p--; G[p].push_back(i); G[i].push_back(p); } rep(j,0,2)rep(i,0,101010)dp[i][j]=0; rep(i,0,101010)dp[i][0]++; dfs(0,-1); cout << dp[0][0] << endl; }