#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int main() {
    int X{};
    cin >> X;

    int surplus = X % 100;

    cout << 100 - surplus << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using ld=long double;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
using vp=vector<P>;
using vvp=vector<vp>;
const int inf=998244353;
const ll INF=9e18/2;
const long double PI = acosl(-1.0); 
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
long long modpow(long long x, long long y,long long mod) {
    long long res = 1;
    while (y) {
        if (y % 2) res =  res * x % mod;
        y >>= 1;
        x = 1LL * x * x % mod;
    }
    return res;
}

ll cnt=0;
vll g;
bool used[220000];
bool r[220000];

bool dfs(ll now){
  used[now]=true;
  if(used[g[now]]){
    bool ret=!(r[g[now]]);
    r[now]=true;
    return ret;
  }
  bool ret=dfs(g[now]);
  r[now]=true;
  return ret;
}

int main(){//cout<<fixed<<setprecision(20);
  ll n;
  cin>>n;
  g.resize(n);
  rep(i,0,n){
    ll a;
    cin>>a;
    a--;
    g[i]=(a);
  }
  rep(i,0,n){
   if(used[i])continue;
   if(dfs(i))cnt++; 
  }
  ll ans=modpow(2,cnt,inf)-1;
  if(ans<0)ans+=inf;
  cout<<ans<<endl;
}