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

vector< pair< long long, long long > > prime_factorize(long long N) {
    vector< pair< long long, long long > > res;
    for(long long a = 2; a * a <= N; ++a) {
        if(N % a != 0)
            continue;
        long long ex = 0;
        while(N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if(N != 1)
        res.push_back({N, 1});
    return res;
}

int main() {
    unsigned long long N;
    cin >> N;
    int res = 2;
    N /= (N & -N);
    for(const auto &p : prime_factorize(N)) {
        res *= (p.second + 1);
    }

    cout << res << endl;
}
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define REP(i,k,n) for(ll i=k;i<ll(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define UNIQUE(a) sort(all(a));a.erase(unique(all(a)),a.end())
#define decimal cout<<fixed<<setprecision(10)
using ll=long long;
using P=pair<ll,ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
constexpr ll inf=1001001001001001;
constexpr int INF=1001001001;
constexpr int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
void YesNo(bool b){if(b)out("Yes");else out("No");}
void yesno(bool b){if(b)out("yes");else out("no");}
void YESNO(bool b){if(b)out("YES");else out("NO");}
ll modpow(ll a,ll b){ll c=1;while(b>0){if(b&1){c=a*c%mod;}a=a*a%mod;b>>=1;}return c;}
vi calc(ll x){vi v;while(x>0){v.eb(x%10);x/=10;}reverse(all(v));return v;}

struct UnionFind{
  vi d;
  UnionFind(ll n=0):d(n,-1){}
  ll find(ll x){
    if(d[x]<0) return x;
    return d[x]=find(d[x]);
  }
  bool unite(ll x,ll y){
    x=find(x); y=find(y);
    if(x==y) return false;
    if(d[x]>d[y]) swap(x,y);
    d[x]+=d[y];
    d[y]=x;
    return true;
  }
  bool same(ll x,ll y){return find(x)==find(y);}
  ll size(ll x){return -d[find(x)];}
};

int main(){
    ll n; cin>>n;
    vi a(n);
    rep(i,n) cin>>a[i];
    ll m=200005;
    UnionFind uf(m);
    rep(i,n){
        uf.unite(a[i]-1,a[n-i-1]-1);
    }
    vi v(m,0);
    rep(i,m){
        v[uf.find(i)]=uf.size(i);
    }
    ll ans=0;
    rep(i,m){
        if(v[i]>0) ans+=v[i]-1;
    }
    out(ans);
    //outv(v);
}