stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.3909763646416617x):
/*

https://blog.csdn.net/weixin_30466421/article/details/97091246

如果 (color[x]±1 \mod 3 =color[u]) 且 (x,u) 在同一连通块内,则一定有边存在 （这个可以想明白，大概是一些箭头的指来指去？然后同一联通块里箭头同一方向的块，每个这样的块是符合这个性质的，相邻块间又有一个交错的点，就全连起来了。。。）

*/

#include <bits/stdc++.h>

#define rep(i, x, y) for (int i = x; i <= y; i++)

using namespace std;



const int N = 1e5 + 10;

typedef long long ll;

int n, m, vis[N], col[N], ff;

int lnk[N], to[N << 1], nxt[N << 1], cnt = 1, val[N << 1], vise[N];

ll ans, sz, tot, num[3];



void add(int x, int y, int z) {

    to[++cnt] = y, nxt[cnt] = lnk[x], lnk[x] = cnt, val[cnt] = z;

}



void dfs(int x) {

    vis[x] = 1;

    ++sz;

    num[col[x]]++;

    for (int i = lnk[x]; i; i = nxt[i]) {

        int y = to[i];

        if (!vise[i >> 1]) {  // 只能算一次！！！

            vise[i >> 1] = 1;

            tot++;

            if (!vis[y]) {

                col[y] = (col[x] + val[i] + 3) % 3;

                dfs(y);

            } else ff |= (col[y] != ((col[x] + val[i] + 3) % 3));

        }

    }

}



int main() {

    cin >> n >> m;

    rep(i, 1, m) {

        int x, y; cin >> x >> y;

        add(x, y, 1), add(y, x, -1);  // 两条边在统计边数时只能算一次！看上面！！

    }

    rep(i, 1, n) if (!vis[i]) {

        sz = tot = ff = 0; rep(j, 0, 2) num[j] = 0;

        dfs(i);

        if (ff)  // 有点被染上相同颜色

            ans += sz * sz;

        else if (!num[0] || !num[1] || !num[2])  // 只有 <=2 种颜色

            ans += tot;

        else

            ans += num[0] * num[1] + num[1] * num[2] + num[2] * num[0];

    }

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

    return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.4029717494964224x):
#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); 

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.249779411886658x):
#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);

}
// Slower C++ solution:
//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;

}

// Faster C++ solution for the same problem (measured speedup: 5.242313430277847x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.243301294614499x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 6.199307096247735x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.182218551656525x):
#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;

  }
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1969557859399578x):
#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);

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1814281043815655x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1694979249682833x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1824440082434284x):
#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;

    

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1817745782519349x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.182245237938508x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1659212641848085x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1658737536657087x):
#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";



}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1691674858130898x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.236949933935653x):
#include<stdio.h>



int main()

{

    int N, count=0, min, i=0;



    scanf("%d", &N);



    int P[N+5];



    while(i != N)

    {

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

        i++;

    }



    if(P[0] <= N)

        {

            count++;

            //printf("1st count = %d\n", count);

            min = P[0];

        }



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

    {

        if(P[i] < min)

        {

            min = P[i];

            count++;

            //printf("count = %d\nmin = %d=%d\n", count, i, min);

        }

    }



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



    return 0;

}
// Slower C++ solution:
//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;

}

// Faster C++ solution for the same problem (measured speedup: 5.229502197788016x):
#include<stdio.h>



int main()

{

    int N, count=0, min, i=0;



    scanf("%d", &N);



    int P[N+5];



    while(i != N)

    {

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

        i++;

    }



    if(P[0] <= N)

        {

            count++;

            //printf("1st count = %d\n", count);

            min = P[0];

        }



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

    {

        if(P[i] < min)

        {

            min = P[i];

            count++;

            //printf("count = %d\nmin = %d=%d\n", count, i, min);

        }

    }



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



    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.23048764796919x):
#include<stdio.h>



int main()

{

    int N, count=0, min, i=0;



    scanf("%d", &N);



    int P[N+5];



    while(i != N)

    {

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

        i++;

    }



    if(P[0] <= N)

        {

            count++;

            //printf("1st count = %d\n", count);

            min = P[0];

        }



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

    {

        if(P[i] < min)

        {

            min = P[i];

            count++;

            //printf("count = %d\nmin = %d=%d\n", count, i, min);

        }

    }



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



    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 6.184157150419014x):
#include<stdio.h>



int main()

{

    int N, count=0, min, i=0;



    scanf("%d", &N);



    int P[N+5];



    while(i != N)

    {

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

        i++;

    }



    if(P[0] <= N)

        {

            count++;

            //printf("1st count = %d\n", count);

            min = P[0];

        }



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

    {

        if(P[i] < min)

        {

            min = P[i];

            count++;

            //printf("count = %d\nmin = %d=%d\n", count, i, min);

        }

    }



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



    return 0;

}