Loading Similar Posts
//SUPERIOR ARRAY ELEMENT
#include<bits/stdc++.h>
using namespace std;
int helper(vector<int> &v){
int n = v.size();
int cnt = 1; //last element always counted
vector<int> maxi(n);
maxi[n-1] = v[n-1];
for(int i=n-2; i>=0; i--){
if(v[i]>maxi[i+1]){
cnt++;
maxi[i] = v[i];
}
else{
maxi[i] = maxi[i+1];
}
}
return cnt;
}
int main(){
int n;
cin>>n;
vector<int> v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}
cout<<helper(v)<<endl;
return 0;
}