Topics
such as the red dot represents a cold drawing ant, in his infected left with his back must not, in the opposite direction to his right and he must have been infected, on his right and he certainly does not infect the same direction, in he will not be left to him with the same infection depends on his right there he acts contrary to the direction of the ants.
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=55;
int n;
bool cmp(int a,int b)
{
return abs(a)<abs(b);
}
int a[N];
int main()
{
int t;
int ans=0;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
t=a[0];
sort(a,a+n,cmp);
for(int i=0;i<n;i++)
if(a[i]==t) {t=i;break;}
if(a[t]>0)
{ for(int i=t+1;i<n;i++)
if(a[i]<0) ans++;
for(int i=0;i<t;i++)
if(ans&&a[i]>0) ans++;
}
else
{
for(int i=0;i<t;i++)
if(a[i]>0) ans++;
for(int i=t+1;i<n;i++)
if(ans&&a[i]<0) ans++;
}
printf("%d\n",ans+1);
}