Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- int n,mx,mn,cnt=0,x;
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cin>>x;
- if(i==0)
- {
- mn=x;
- mx=x;
- }
- else
- {
- if(x>mx||x<mn)
- {
- cnt++;
- mx=max(mx,x);
- mn=min(mn,x);
- }
- }
- }
- cout<<cnt<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment