#include<bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
int n,i,a[200001],kq=1; map<int,int> mp;
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a[i]; mp[a[i]]=i;
}
sort(a+1,a+n+1);
for(i=1;i<n;i++)
{
if (mp[a[i]]>mp[a[i+1]]) kq++;
}
cout<<kq;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBpbnQgbG9uZyBsb25nCiNkZWZpbmUgZW5kbCAiXG4iCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBuLGksYVsyMDAwMDFdLGtxPTE7IG1hcDxpbnQsaW50PiBtcDsKc2lnbmVkIG1haW4oKQp7Cglpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKCWNpbj4+bjsKCWZvcihpPTE7aTw9bjtpKyspCgl7CgkJY2luPj5hW2ldOyBtcFthW2ldXT1pOwoJfQoJc29ydChhKzEsYStuKzEpOwoJZm9yKGk9MTtpPG47aSsrKQoJewoJCWlmIChtcFthW2ldXT5tcFthW2krMV1dKSBrcSsrOwoJfQoJY291dDw8a3E7Cn0=