#include <bits/stdc++.h>

#define rep(i, n) for (auto i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()

using namespace std;

using ll = long long int;

const ll MOD_NUM = 998244353;

// 二分累乗法
ll pow_mod(ll n, ll p, ll m) {
    const int N = 64;

    vector<ll> memory(N);
    memory[0] = n % m;
    rep(i, N) memory[i + 1] = memory[i] * memory[i] % m;

    ll ans = 1;
    rep(i, N) {
        ll k = p >> i;
        if (k == 0)
            break;
        else if (k & 1)
            ans = (ans * memory[i]) % m;
    }

    return ans;
}

int main() {
    // Input
    int N;
    cin >> N;
    map<int, int> f;
    rep(i, N) cin >> f[i + 1];

    // Process
    vector<bool> watched(N + 1, false);
    int watched_num = 0;

    int group_num = 0;
    int start = 1;
    while (watched_num < N) {
        while (watched[start]) start++;

        vector<int> watch_nums;
        int current;
        for (current = start; !watched[current]; current = f[current]) {
            watch_nums.emplace_back(current);

            watched[current] = true;
            watched_num++;
        }

        bool current_watch = false;
        for (int n : watch_nums) {
            if (n == current) current_watch = true;
        }
        if (current_watch) group_num++;
    }

    ll ans = pow_mod(2, group_num, MOD_NUM);
    ans = (ans + MOD_NUM - 1) % MOD_NUM;

    // Output
    cout << ans << endl;

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    const int M = 200;

    int N;
    cin >> N;

    vector<int> A(N);
    for (int& a : A) { cin >> a; }

    vector<vector<int>> rest(M);
    vector<int> ans1, ans2;
    bool flag = false;
    for (int i = 0; i < N; ++i)
    {
        int r = A[i] % M;
        if (rest[r].empty()) { rest[r].push_back(i); }
        else
        {
            ans1 = rest[r];
            ans2.push_back(i);
            flag = true;
            break;
        }

        for (int m = 0; m < M; ++m)
        {
            if (rest[m].empty()) { continue; }

            auto it = find(rest[m].begin(), rest[m].end(), i);
            if (it != rest[m].end()) { continue; }

            vector<int> temp(rest[m]);
            temp.push_back(i);

            int j = (m + r) % M;
            if (rest[j].empty()) { rest[j] = temp; }
            else
            {
                ans1 = rest[j];
                ans2 = temp;
                flag = true;
                break;
            }
        }

        if (flag) { break; }
    }

    if (flag)
    {
        cout << "Yes" << endl;
        cout << ans1.size();
        for (int i : ans1) { cout << " " << (i + 1); }
        cout << endl;
        cout << ans2.size();
        for (int i : ans2) { cout << " " << (i + 1); }
        cout << endl;
    }
    else
    {
        cout << "No" << endl;
    }


    return 0;
}
