stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



typedef long long lint;

typedef long double louble;



template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}

template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}



namespace ae86

{

	const int bufl = 1<<15;

	

	char buf[bufl],*s=buf,*t=buf;

	

	inline int fetch()

	{

		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}

		return *s++;

	}

	

	inline int ty()

	{

		int a=0,b=1,c=fetch();

		while(!isdigit(c))b^=c=='-',c=fetch();

		while(isdigit(c))a=a*10+c-48,c=fetch();

		return b?a:-a;

	}

}

using ae86::ty;



const int _ = 100007 , __ = _<<1;



int to[__],ne[__],ev[__],he[_]={0},ecnt=1;

inline void adde(int a,int b,int c){to[++ecnt]=b,ev[ecnt]=c,ne[ecnt]=he[a],he[a]=ecnt;}



int n,m,col[_],ccnt[3],ef,pf,failed;



void dfs(int x,int now)

{

	col[x]=now,pf++,ccnt[col[x]]++;

	for(int i=he[x];i;i=ne[i])

	{

		int b=to[i],v=(now+ev[i]+3)%3;

		ef+=ev[i]>0;

		if(col[b]<0)dfs(b,v);

		else if(col[b]!=v)failed=1;

	}

}



int main()

{

	n=ty(),m=ty();

	for(int i=1,a,b;i<=m;i++)a=ty(),b=ty(),adde(a,b,1),adde(b,a,-1);



	lint ans=0;

	

	memset(col,-1,sizeof(col));

	for(int i=1;i<=n;i++)

	{

		if(col[i]>=0)continue;

		ccnt[0]=ccnt[1]=ccnt[2]=ef=pf=failed=0,dfs(i,0);

		if(failed)ans+=1ll*pf*pf;

		else if(ccnt[0] && ccnt[1] && ccnt[2])

			ans+=1ll*ccnt[0]*ccnt[2]+1ll*ccnt[1]*ccnt[0]+1ll*ccnt[2]*ccnt[1];

		else ans+=ef;

	}

	printf("%lld\n",ans);



	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define Rint register int

#define C(n,m) (n<m?0:1ll*fac[n]*invfac[n-m]%mod*invfac[m]%mod)

using namespace std;

int T,n,m,p,k,head[100010],o=0,sz,ed,cnt[3],c[100010];

bool can,vis[100010];

struct edge{

	int to,link,w;

}e[200010];

void add_edge(int u,int v){

	e[++o].to=v,e[o].link=head[u],head[u]=o,e[o].w=1;

	e[++o].to=u,e[o].link=head[v],head[v]=o,e[o].w=2;

}

void dfs(int u,int col){

	cnt[col]++;vis[u]=true;c[u]=col,sz++;

	for(int i=head[u];i;i=e[i].link){

		if(e[i].w==1) ed++;

		if(vis[e[i].to]){

			if(c[e[i].to]!=(col+e[i].w)%3) can=false;

			continue;

		}

		dfs(e[i].to,(col+e[i].w)%3);

	}

}

int main(){

	scanf("%d%d",&n,&m);

	for(int i=1,u,v;i<=m;i++) scanf("%d%d",&u,&v),add_edge(u,v);

	long long ans=0;

	for(int i=1;i<=n;i++){

		if(vis[i]) continue;

		sz=ed=cnt[0]=cnt[1]=cnt[2]=0;can=true;

		dfs(i,0);

		if(!can) ans+=1ll*sz*sz;

		else{

			if(!min(min(cnt[0],cnt[1]),cnt[2])) ans+=ed;

			else ans+=1ll*cnt[0]*cnt[2]+1ll*cnt[0]*cnt[1]+1ll*cnt[1]*cnt[2];

		}

	}

	printf("%lld\n",ans); 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include<algorithm>

#include<string>

#include<vector>

#include<cmath>

#include<map>

using namespace std;

int main()

{

	int num, count = 1, min;

	cin >> num;

	int *arr = new int[num];

	bool smaller = false;

	for (int i = 0; i < num; i++)

		cin >> arr[i];



	min = arr[0];

	for (int i = 1; i < num; i++)

	{

		if (arr[i] <= arr[i - 1] && arr[i] <= min)

		{

			count++;

			min = arr[i];

		}

		

	}

	cout << count << endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

using namespace std;

int main()

{

    bool fi=true;

    long long n,x,mi,tr=0;

    scanf("%lld",&n);

    while(n--){

        scanf("%lld",&x);

        if(fi){

            mi=x;

            tr++;

            fi=false;

        }

        else{

            if(x<mi){

                mi=x;

                tr++;

            }

            else continue;

        }

    }

    printf("%lld",tr);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//https://blog.csdn.net/hesorchen

// #include <bits/stdc++.h>

#include <iostream>

#include <algorithm>

using namespace std;

#define ll long long

#define mem(a, b) memset(a, b, sizeof(a))

#define lowbit(a) (a & (-a))

#define mod 1000000007

#define endl "\n"



int main()

{

    ll n, minn = 1000000009, a;

    cin >> n;

    ll ans = 0;

    while (n--)

    {

        cin >> a;

        if (a <= minn)

            ans++;

        minn = min(minn, a);

    }

    cout << ans << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

using namespace std;

int main()

{

    bool fi=true;

    long long n,x,mi,tr=0;

    scanf("%lld",&n);

    while(n--){

        scanf("%lld",&x);

        if(fi){

            mi=x;

            tr++;

            fi=false;

        }

        else{

            if(x<mi){

                mi=x;

                tr++;

            }

            else continue;

        }

    }

    printf("%lld",tr);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int min,result=1,temp,i=0;

	cin>>min;

	n--;

	for(;i<n;i++){

		cin>>temp;

		if(temp<min){

			result++;

			min=temp;

		}

	}

	cout<<result<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

using namespace std;

int main()

{

    bool fi=true;

    long long n,x,mi,tr=0;

    scanf("%lld",&n);

    while(n--){

        scanf("%lld",&x);

        if(fi){

            mi=x;

            tr++;

            fi=false;

        }

        else{

            if(x<mi){

                mi=x;

                tr++;

            }

            else continue;

        }

    }

    printf("%lld",tr);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    long long n;

    long long num[1000000];

    long long min1;

    long long sum=0;

    cin>>n;

    cin>>num[0];

    min1=num[0];

    for(int i=1;i<n;i++)

    {

        cin>>num[i];

        if(num[i]<min1)

            {

                sum++;

                min1=num[i];

            }

    }

    cout<<sum+1<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

using namespace std;

int main()

{

    bool fi=true;

    long long n,x,mi,tr=0;

    scanf("%lld",&n);

    while(n--){

        scanf("%lld",&x);

        if(fi){

            mi=x;

            tr++;

            fi=false;

        }

        else{

            if(x<mi){

                mi=x;

                tr++;

            }

            else continue;

        }

    }

    printf("%lld",tr);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

 

int ar[300005];

int vis[300005];

int main()

{

  int n, i, j=1, ok=0,mi=300005;

 

  cin>>n;

 

  for(i=1; i<=n; i++)

  {

    cin>>ar[i];

  }

 

  for(i=1; i<=n; i++)

  {

    mi=min(ar[i],mi);

    if(mi==ar[i])ok++;

  }

 

  cout<<ok<<endl;

  }


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int n;



int main() {

   scanf("%d" , &n);

   int sol = 0, currMin = INT_MAX;

   for (int i = 0 ; i < n ; i++) {

      int x; scanf("%d" , &x);

      if (currMin == INT_MAX) {

         ++sol;

      } else {

         if (currMin >= x) sol++;

      }

      currMin = min(currMin , x);

   }

   printf("%d\n" , sol);

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



#define pb push_back

#define F first

#define S second

#define fo(i,a,b)  for(int i = a; i < b; i++)



using ll = long long;

using ld = long double;

using ul = unsigned long long;

using ii = pair<int, int>;

#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define ReadFile            freopen("input.in","r",stdin)

#define WriteFile           freopen("output.txt","w",stdout)

const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;

const ld EPS = 1e-7;

double Pi=acos(-1);

const ld rad=Pi/180.0;

ll power(ll x, ll y, ll p)

{

    ll res = 1;

    while (y > 0)

    {

        if (y & 1)

            res = (res*x) % p;

        y = y>>1;

        x = (x*x) % p;

    }

    return res;

}

ll nCr (ll n,ll m)

{

    return(m == 0)?1:n*nCr(n-1,m-1)/m;

}

/*****************************************************/



const int N = (int) 2e5 + 3;



int a[N];



int main()

{

    int n;

    cin >> n;



    for(int i = 0; i < n; ++i)

        cin >> a[i];

    int cnt = 1 , x = a[0];

    for(int i = 1; i < n; ++i){

        x = min(x , a[i]);

        if(a[i] == x)

            cnt++;

    }



    cout << cnt << "\n";



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include "bits/stdc++.h"

#include "sstream"

#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

const int N=2e3+1;

int main() {

    quick

int  n,mn=INT_MAX,ans=0,x; cin>>n;

while(n--){

    cin>>x;

    if(x<=mn){mn=min(mn,x),ans++;}

}

cout<<ans;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

//#include <vector>

#include <algorithm>



using namespace std;



int main(){

    int n, maxNum = 10000000,count=0;

    

    cin>>n;

    for (int i = 0; i < n; i++)

    {

        int x;

        cin>>x;



        if (x<=maxNum)

        {

            count++;

        }

        maxNum = min(x,maxNum);

        



    }



    cout<<count<<endl;

    

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;



int main(void)

{

    //freopen("input.txt", "r", stdin);



    int n, i, val, cnt = 1;

    cin >> n;

    int big;

    cin >> big;

    for(i = 1; i < n; i++)

    {

        cin >> val;

        if(val <= big)

        {

            big = val;

            cnt++;

        }

    }

    cout << cnt << "\n";



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

#define ll long long

#include <cmath>

using namespace std;



int main()

{

    int n, temp, i, cnt=0;

    cin >> n;

    int p[n];

    for (i=0; i<n; i++)

    {

        cin >> p[i];

    }

    temp=p[0];

    for (i=0; i<n; i++)

    {

        if (temp>p[i])

        {

            temp=p[i];

            cnt++;

        }

    }

    cout << cnt+1 << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define ll long long

#define endl "\n"

using namespace std;



int p[2 * (int)1e5];



int main()

{

    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    

    int n, cnt = 0, least = 2 * (int)1e5 + 1;

    cin >> n;

    

    for (int i = 0; i < n; i++)

    {

        cin >> p[i];

        if (p[i] < least)

        {

            ++cnt;

            least = p[i];

        }

        

    }



    cout << cnt << endl;

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



#define ll long long

#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 2000001;

int arr[N];

int main()

{

    fast_io;

    int n ;

    cin >> n ;

    for(int i = 0; i < n ; i++)

    {

        cin >> arr[i];

    }

    int cnt = 1;

    for(int i = 0 ; i < n - 1 ; i++)

    {

        if(arr[i] > arr[i + 1])

        {

            cnt ++;

        }

        else

        {

            arr [i+1] = arr[i];

        }

    }

    cout << cnt << "\n";



}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;





int main(void)

{

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int n;

    cin >> n;

    int a[n];

    for(int i = 0; i < n; i ++)

    {

        cin >> a[i];

    }

    int count = 1;

    for(int i = 1; i < n; i++)

    {

        if(a[i] < a[i-1])

            count++;

        else

            a[i] = a[i-1];

    }

    cout << count;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



    printf("%d\n",x);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <queue>

using namespace std;



priority_queue<int, vector<int>, greater<int> > pq;



int main(void)

{

    int n, p, ans = 0;



    scanf("%d" ,&n);

    pq.push(n + 1);

    while (n--)

    {

        scanf("%d" ,&p);



        if (pq.top() >= p)

            ++ans;



        pq.push(p);

    }



    printf("%d" ,ans);

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(void)

{

    int n, p, ans = 0, mini = 222222;



    scanf("%d" ,&n);

    while (n--)

    {

        scanf("%d" ,&p);



        if (mini >= p)

            ++ans;



        if (mini > p)

			mini = p;

    }



    printf("%d" ,ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cmath>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;



const int maxn =300003, INF = 0x7f7f7f7f;

int low[maxn], a[maxn];

int n, ans;



int binary_search(int *a, int r, int x)

//二分查找，返回a数组中第一个>=x的位置

{

    int l = 1, mid;

    while(l <= r)

    {

        mid = (l+r) >> 1;

        if(a[mid] <= x)

            l = mid + 1;

        else

            r = mid - 1;

    }

    return l;

}



int main()

{

    scanf("%d", &n);

    for(int i=1; i<=n; i++)

    {

        scanf("%d", &a[i]);

        low[i] = INF;   //由于low中存的是最小值，所以low初始化为INF

    }

    low[1] = a[1];

    ans = 1;   //初始时LIS长度为1

    for(int i=2; i<=n; i++)

    {

        if(a[i] < low[ans])    //若a[i]>=low[ans]，直接把a[i]接到后面

            low[++ans] = a[i];

        else       //否则，找到low中第一个>=a[i]的位置low[j]，用a[i]更新low[j]

            low[binary_search(low, ans, a[i])] = a[i];

    }

    printf("%d\n", ans);   //输出答案

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int ma[400008],fa[400008];

int main(){

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

        scanf("%d",ma+i);

    int len=1,mi=ma[0];

    for(int i=1;i<n;i++){

        if(mi>ma[i])

            mi=ma[i],len++;

    }

    printf("%d\n",len);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// https://github.com/atcoder-live/library

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vi = vector<int>;

using vvi = vector<vi>;

#define ote(x) cout<<(x)<<endl

#define all(x) (x).begin(),(x).end()

#define rp(i,s,e) for(int i=(s);i<(e);++i)

#define rpz(i,e) rp(i,0,(e))

#define irp(i,s,e) for(int i=(s);i>(e);--i)

#define irpz(i,s) irp(i,(s),-1)

template<class T> T in(){T x;cin>>x;return x;}

// long long a = in<long long>();

template<class T> void inarr(int s,int e,T &v){rp(i,s,e)cin>>v[i];}

// inarr<vi>(0,N,V);

#define NMAX 1000000

int N;

vi P(NMAX);



int solve(){

	int ans=0;

	int minP = INT_MAX;

	rpz(i,N){

		if(minP>=P[i]){

			minP = P[i];

			ans++;

		}

		else{



		}

	}

	return ans;

}



int main(){

	cin>>N;

	rpz(i,N) cin>>P[i];

	ote(solve());

}


// Optimized solution to the same problem (faster):
// C - Low Elements

#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;

#define rp(i,s,e) for(int i=(s);i<(e);++i)

template<class T> T in(){T x;cin>>x;return x;}

template<class T> vector<T> inarr(int s,int e, T init){

	vector<T> v;T x;

	rp(i,0,s)v.push_back(init);

	rp(i,s,e){x=in<T>();v.push_back(x);}

	return v;

}



int N;

vi P;



int solve(){

	int ans=0;

	int minP = INT_MAX;

	rp(i,0,N){

		if(minP >= P[i]){

			minP = P[i];

			ans++;

		}

	}

	return ans;

}



int main(){

	cin>>N;

	P = inarr<int>(0,N,0);

	cout<< solve() <<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define rep(i,r) for (int i = 0; i < r; i++)

#define isc(n) scanf("%d", &n)



int main() {

  int N;

  scanf("%d", &N);

  int count = 0;

  for (int i = 0, m = N, P; i < N; i++) {

    scanf("%d", &P);

    if (P <= m) {

      m = P;

      count++;

    }

  }

  printf("%d", count);

  return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int N;

  scanf("%d", &N);

  int count = 0;

  for (int i = 0, m = N, P; i < N; i++) {

    scanf("%d", &P);

    if (P <= m) {

      m = P;

      count++;

    }

  }

  printf("%d", count);

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



int main(){

  int N;

  cin >> N;

  vector<int> P(N);

  vector<int> minP(N);

  cin >> P[0];

  minP[0] = P[0];

  for(int i = 1; i < N; i++){

    cin >> P[i];

    minP[i] = min(P[i], minP[i - 1]);

  }

  

  int cnt = 0;

  for(int i = 0; i < N; i++){

    if(minP[i] >= P[i]) cnt++;

  }

  

  cout << cnt << endl;

  

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



int main(){

  int N;

  scanf("%d", &N);

  int in;

  int m_in = 200000;

  int cn = 0;

  for(;N-->0;){

    scanf("%d", &in);

    if(m_in >= in){

      cn++;

      m_in = in;

    }

  }

  

  printf("%d\n", cn);

  

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;



ll n, ans=1, dp;

vector<ll> p(201001);



int main(){

  

  cin >> n;

  rep(i,n) cin >> p.at(i);

  

  for (ll i = 1; i < n; i++){

    

    if (i == 1) dp = p.at(0);

    else dp = min (p.at(i-1), dp);

    

      if(dp > p.at(i)) ans++;

    }

  

  cout << ans << endl;

  

  }

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;

const int inf = 1001001001;



int main(){

    int n;

    cin >> n;

    

    vector<int> p(n);

    rep(i,n) cin >> p.at(i);

    

    int mn = 0, ans = 0;

    

    rep(i,n) {

        if(i == 0 || p.at(i) < mn) {

            ans++;

            mn = p.at(i);

        }

    }

    cout << ans << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int p[200010];

int main(void)

{

    int n,sum=0,mi=1e9;

    cin >> n;

    for(int i=1;i<=n;i++)

        cin >> p[i];

    for(int i=1;i<=n;i++)

    {

        if(p[i]<mi)

        {

            mi=p[i];

            sum++;

        }

    }

    cout << sum;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

int main(void)

{

    int n,sum=0,mi=1e9,p;

    scanf("%d" ,&n);

    while(n--){

        scanf("%d" ,&p);

        if(p<mi)

        {

            mi=p;

            sum++;

        }

    }

    printf("%d" ,sum);

    return 0;

}

// Fastest known solution for this problem: