#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#ifndef ABOBA
#pragma GCC traget("avx2")
#pragma GCC optimize("O3")
#endif

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

constexpr ll inf = 1e18, mod = 998244353;

vector<vector<ll> > g;
vector<ll> pw;
ll ans = 0;
ll x;

ll dfs(ll v) {
    ll mul = 2, sz = 0, sub = 0;
    for (auto i: g[v]) {
        ll cur = dfs(i);
        sz += cur;
        mul = mul * pw[cur] % mod;
        sub = (sub + ((cur * cur - cur) / 2)) % mod;
    }
    if (v == x - 1) {
        ans = ((mul - sz - sub - 1) % mod + mod) % mod;
    }
    return sz + 1;
}

int main() {
    ll n, k;
    cin >> n >> k;
    cin >> x;
    g.resize(n), pw.resize(n + 1, 1);
    pw[1] = 2;
    for (ll i = 1; i < n; ++i) {
        pw[i + 1] = pw[i] * 2 % mod;
        ll p;
        cin >> p;
        g[p - 1].emplace_back(i);
    }
    dfs(0);
    cout << ans;
}

void solve() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll tt = 1;
    //cin >> tt;
    while (tt--) solve();
}
