#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8

double x[Max],x1[Max];

struct Node{
	double point;
	int l;
	int r;
}P[Max];

int cmp(const void *a,const void *b){
	struct Node c=*(struct Node *)a;
	struct Node d=*(struct Node *)b;
	if(c.point>d.point) return 1;
	else return -1;
}

int main(){
	int k[Max],b[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
			//P[ii].point=(-b[i]*1.0)/k[i];
				P[i].point=xx;
				if(k[i]<0) {
					P[i].l=k[i];
					P[i].r=0;
				}else{
					P[i].l=0;
					P[i].r=k[i];
				}
		}
		int t=1;
	//	printf("%d\n",ii);

		qsort(P,n,sizeof(P[0]),cmp);
		for(i=0;i<n;i++)
		{
			j=i;
			while(P[i+1].point==P[j].point&&i+1<n)
			{
				P[j].l+=P[i+1].l;
				P[j].r+=P[i+1].r;
				i++;
			}
			if(P[j].l!=P[j].r)
			   ii++;
		}
		printf("%d\n",ii);

	}
//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=(-b*1.0)/k;
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>esp)
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     int b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%d %d",&k,&b);
         if(k!=0)
         a[++m]=-(b*1.0)/(k*1.0);
     }
     sort(a+1,a+1+m);
     ans=0;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-8)
         ans++;
     }
     if (m)
     ans++;
     printf("%d\n",ans);
     return 0;
 }


#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <sstream>
#include <cstddef>
#include <algorithm>
#include <utility>
#include <iterator>
#include <numeric>
#include <list>
#include <complex>
#include <cstdio>
#include <climits>
#include <iostream>
#include <fstream>

/*** TEMPLATE CODE STARTS HERE ***/

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef complex<double> pnt;
typedef pair<int, int> pii;

#define RA(x) (x).begin(), (x).end()
#define FE(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define SZ(x) ((int) (x).size())

template<class T>
void splitstr(const string &s, vector<T> &out)
{
    istringstream in(s);
    out.clear();
    copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

static void redirect(int argc, const char **argv)
{
    if (argc > 1)
    {
        static filebuf f;
        f.open(argv[1], ios::in);
        cin.rdbuf(&f);
        if (!cin)
        {
            cerr << "Failed to open '" << argv[1] << "'" << endl;
            exit(1);
        }
    }

    if (argc > 2)
    {
        static filebuf f;
        f.open(argv[2], ios::out | ios::trunc);
        cout.rdbuf(&f);
        if (!cout)
        {
            cerr << "Failed to open '" << argv[2] << "'" << endl;
        }
    }
}

/*** TEMPLATE CODE ENDS HERE */

int main(int argc, const char **argv)
{
    redirect(argc, argv);

    int N;
    cin >> N;
    set<pii> angles;
    for (int i = 0; i < N; i++)
    {
        int K, B;
        cin >> K >> B;
        if (K != 0)
        {
            int g = gcd(K, B);
            K /= g;
            B /= g;
            if (K < 0)
            {
                K = -K;
                B = -B;
            }
            angles.insert(pii(K, B));
        }
    }
    cout << angles.size() << '\n';

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8
int main(){
	int k[Max],b[Max];
	double x[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,kk=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			//x[i]=(-b[i]*1.0)/k[i];
			if(k[i]!=0)xx=(-b[i]*1.0)/k[i];
			else continue;
			if(k==0) x[kk++]=xx;
			else{
				bool flag=false;
				for(j=0;j<kk;j++){
					if(fabs(x[j]-xx)<=esp) {
						break;
						flag =true;
					}
				}
				if(flag) continue;
				else x[kk++]=xx;
			}
		}

		printf("%d\n",kk);
	}

//	system("pause");
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
double x[1000],f[1000];
int k[1000],b[1000];
void sll(int k[],int b[],int n,double x[]){
    int i;
    double m=0,s=0;
    for(i=0;i<n;i++){
        s=s+k[i];
        m=m+b[i];
    }
    for(i=0;i<n;i++){
    f[i]=s*x[i]+m;
    }

}
double sl(int k[],int b[],int n,double x){
    int i;
    double m=0,s=0,fx;
    for(i=0;i<n;i++){
        s=s+k[i];
        m=m+b[i];
    }
    fx=s*x+m;
    return fx;
}

double cmp(const int *a,const int *b){
    return(*(int*)a-*(int*)b);
}

int main(){
    int n,i,h,count,ha=0;
    int k[100000],b[100000];
    double a,x1,x2;
    scanf("%d",&n);
    for(h=0;h<n;h++){
        scanf("%d%d",&k[h],&b[h]);
        if(k[h]==0) ha++;
        else{
            x[h]=-(b[h]/k[h]);
        }
    }
    if(ha==n)printf("0");
    else{
    qsort(x,n,sizeof(x[0]),cmp);
    sll(k,b,n,x);
    count=0;
    for(i=0;i<n;i++){
        if(f[i]!=f[i+1])
        count++;
    }
    x1=x[0]-1;
    a=sl(k,b,n,x1);
    if(a!=f[0]) count++;
    x2=x[n]+1;
    a=sl(k,b,n,x2);
    if(a!=f[n]) count++;
    printf("%d\n",count);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
int main()
{
    scanf("%d",&n);
    int i,m=0,ans;
    double b,k;
    for(i=1;i<=n;i++)
    {
        scanf("%lf %lf",&n,&k);
        if(k!=0) a[++m]=-(b/k);
    }
    sort(a+1,a+1+m);
    ans=0;
    for (i=2;i<=m;i++)
    {
        if(fabs(a[i]-a[i-1]>1e-20)) ans++;
    }
    if (m)
    ans++;
    printf("%d\n",ans);
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
const int V = 100500;
long double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=0;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          a[num++]=-(b/k);
      }
      sort(a,a+num);
      for(int i=0;i<num-1;i++)
      {
          if(a[i]!=a[i+1])
             ans++;
      }
      printf("%d\n",ans);
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          if(k==0&&b!=0){
             continue;
          }
          a[num++]=-(b/k);
      }
     // for(int i=0;i<num;i++)
   //      printf("%.6lf ",a[i]);
   //   printf("\n");
      sort(a,a+num);
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
     // system("pause");
      return 0;
}


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     double b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%lf %lf",&k,&b);
         if(k!=0)
         a[++m]=-(b/k);
     }
     sort(a+1,a+1+m);
     if(m==1){printf("0\n");
			continue;}
     ans=1;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }

     printf("%d\n",ans);
     return 0;
 }


#include<iostream>
#include<algorithm>
using namespace std;
long double a[100500];
const long double eps=1e-50;
int judge(long double x){
    if(x<-eps) return -1;
    if(x>eps) return 1;
    return 0;
}
int main(){
    int n;
    double k,b;
    int l=0;
      cin>>n;
    for(int i=0;i<n;i++){
        cin>>k>>b;
        if(k!=0) a[l++]=0-(b/k);
    }
    sort(a,a+l);
    int ans=0;
    for(int i=1;i<l;i++){
        if(judge(a[i]-a[i-1])!=0)
            ans++;
    }
    if(l) ans++;
    cout<<ans<<endl;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];

int main(){
	int k[Max],b[Max];
	double P[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
				P[i]=xx;
		}
		int t=1;
		sort(P,P+n);
		ii=1;
		for(i=1;i<n;i++)
		{
			if(fabs(P[i]-P[i-1])<=esp)
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int x,int y)
{
	if(!x||!y)return x>y?x:y;
    for(int t;t=x%y;x=y,y=t);
	return y;
}
struct node
{
	int k;
	int b;
	double x;
} P[Max];
int cmp(const void *a,const void *b)
{
	node aa=*(node *)a;
	node bb=*(node *)b;
	double k=aa.x-bb.x;
	if(k<0) return -1;
	else
		   return 1;
}
bool cmp1(node a,node b){
    return a.x<b.x;
}
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else if(b[i]==0){
                P[jj].k=k[i];
				P[jj].b=b[i];
				P[jj++].x=0.0;
			}else{
				int pp=abs(gcd(b[i],k[i]));
			    P[jj].k=k[i]/pp;
				P[jj].b=b[i]/pp;
				P[jj++].x=(-b[i]*1.0)/(k[i]*1.0);
			}
		}
		//for(i=0;i<jj;i++)
		//{
          //   printf("%d %d %lf\n",P[i].k,P[i].b,P[i].x);
      //  }
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		//qsort(P,jj,sizeof(P[0]),cmp);
		sort(P,P+jj,cmp1);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
struct node
{
    int k1;
    double point;
    int k2;
}s[100010];
int cmp(const void *a, const void *b)
{
    struct node *aa = (node *)a;
    struct node *bb = (node *)b;
    return (((aa->point)>(bb->point))?1:-1);
}
int main()
{
    int n, k, b;
    int ans;
    int pk, nk;
    while(scanf("%d", &n) != EOF)
    {
        ans = 0; pk=0; nk=0;
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &k, &b);
            if(k==0){
                s[i].point = 0;
                s[i].k1 = 0;
                s[i].k2 = 0;
            }
            else if(k > 0){
                s[i].point = -(double)b/(double)k;
                s[i].k1 = 0;
                s[i].k2 = k;
            }
            else if(k < 0){
                s[i].point = -(double)b/(double)k;
                s[i].k1 = k;
                s[i].k2 = 0;
            }
            pk += s[i].k1;
        }
        qsort(s, n, sizeof(s[0]), cmp);
        for(int i=0, t=0; i<n; i++)
        {
            if(t==(n-1))
            {
                nk = nk - s[t].k1 + s[t].k2;
                t++;
            }
            else{
                while((s[t+1].point-s[t].point) == 0)
                {
                    nk = nk - s[t].k1 + s[t].k2;
                    t++;
                }
                nk = nk - s[t].k1 + s[t].k2;
                t++;
            }
            if(pk != nk)
            {
                ans++;
                pk = nk;
            }
            i = t-1;
        }
        printf("%d\n", ans);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int x,int y)
{
	if(!x||!y)return x>y?x:y;
    for(int t;t=x%y;x=y,y=t);
	return y;
}
struct node
{
	int k;
	int b;
	double x;
} P[Max];
int cmp(const void *a,const void *b)
{
	node aa=*(node *)a;
	node bb=*(node *)b;
	int k=aa.x-bb.x;
	if(k<0) return -1;
	else
		   return 1;
}
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else if(b[i]==0){
                P[jj].k=k[i];
				P[jj].b=b[i];
				P[jj++].x=0.0;
			}else{
				int pp=gcd(b[i],k[i]);
			    P[jj].k=k[i]/pp;
				P[jj].b=b[i]/pp;
				P[jj++].x=(-b[i]*1.0)/(k[i]*1.0);
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		qsort(P,jj,sizeof(P[0]),cmp);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8

double x[Max],x1[Max];

struct Node{
	double point;
	int l;
	int r;
}P[Max];

int cmp(const void *a,const void *b){
	struct Node c=*(struct Node *)a;
	struct Node d=*(struct Node *)b;
	if(c.point>d.point) return 1;
	else return -1;
}
int k[Max],b[Max];
int main(){

	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
				P[i].point=xx;
				if(k[i]<0) {
					P[i].l=k[i];
					P[i].r=0;
				}else{
					P[i].l=0;
					P[i].r=k[i];
				}
		}
		int t=1;
		qsort(P,n,sizeof(P[0]),cmp);
		for(i=0;i<n;i++)
		{
			j=i;
			while(P[i+1].point==P[j].point&&i+1<n)
			{
				P[j].l+=P[i+1].l;
				P[j].r+=P[i+1].r;
				i++;
			}
			if(P[j].l!=P[j].r)
			   ii++;
		}
		printf("%d\n",ii);

	}
//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int x,int y)
{
	if(!x||!y)return x>y?x:y;
    for(int t;t=x%y;x=y,y=t);
	return y;
}
struct node
{
	int k;
	int b;
	int g;
	double x;
} P[Max];
int cmp(const void *a,const void *b)
{
	node aa=*(node *)a;
	node bb=*(node *)b;
	double k=aa.x-bb.x;
	if(k<0) return -1;
	else
		   return 1;
}
bool cmp1(node a,node b){
    return a.x<b.x;
}
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else if(b[i]==0){
                P[jj].k=k[i];
				P[jj].b=b[i];
				P[jj].g=0;
				P[jj++].x=0.0;
			}else{
				int pp=abs(gcd(b[i],k[i]));
			    P[jj].k=k[i]/pp;
				P[jj].b=b[i]/pp;
				P[jj].g=pp;
				P[jj++].x=(-P[jj].b*1.0)/(P[jj].k*1.0);
			}
		}
		//for(i=0;i<jj;i++)
		//{
          //   printf("%d %d %lf\n",P[i].k,P[i].b,P[i].x);
      //  }
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		qsort(P,jj,sizeof(P[0]),cmp);
		//sort(P,P+jj,cmp1);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
int main()
{
    int i,m=0,ans;
    double b,k;
     while(~scanf("%d",&n))
     {
         m=0;
        for(i=1;i<=n;i++)
        {
            scanf("%lf %lf",&k,&b);
            if(k!=0) a[++m]=-(b/k);
        }
        sort(a+1,a+1+m);
        ans=0;
        for (i=2;i<=m;i++)
        {
            if(fabs(a[i]-a[i-1]>1e-20)) ans++;
        }
        if (m) ans++;
        printf("%d\n",ans);
     }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];

int cmp(const void *a,const void *b){
	double c=*(double *)a;
	double d=*(double *)b;
	if(c>d) return 1;
	else return -1;
}

int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    P[jj++]=(-b[i]*1.0)/(k[i]*1.0);
			    //jj;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
	//int t=1;
		qsort(P,jj,sizeof(P[0]),cmp);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i]==P[i-1])
				continue;
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int x,int y)
{
	if(!x||!y)
	{
		return x>y?x:y;}
		for(int t;t=x%y;x=y,y=t);
		return y;
}
struct node
{
	int k;
	int b;
	double x;
} P[Max];
int cmp(const void *a,const void *b)
{
	node aa=*(node *)a;
	node bb=*(node *)b;
	int k=aa.x-bb.x;
	if(k<0) return -1;
	else
		   return 1;
}
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
				int pp=gcd(b[i],k[i]);
			    P[jj].k=k[i]/pp;
				P[jj].b=b[i]/pp;
				P[jj++].x=(-b[i]*1.0)/(k[i]*1.0);
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		qsort(P,jj,sizeof(P[0]),cmp);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
double s[100010];
int main()
{
    int n;
    int k, b;
    while(scanf("%d", &n) != EOF)
    {
        int t=0, ans=0;
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &k, &b);
            if(k!=0)
                s[t++] = -(double)b/(double)k;
        }
        sort(s, s+t);
        for(int i=1; i<t; i++)
        {
            if(s[i]!=s[i-1])
                ans++;
        }
        if(t) ans++;
        printf("%d\n", ans);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=-(b/k);
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>1e-20)
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8
int main(){
	int k[Max],b[Max];
	double x[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,kk=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			//x[i]=(-b[i]*1.0)/k[i];
			if(k[i]!=0)xx=(-b[i]*1.0)/k[i];
			else continue;
			if(k==0) x[kk++]=xx;
			else{
				bool flag=false;
				for(j=0;j<kk;j++){
					if(fabs(x[j]-xx)<=esp) {
						break;
						flag =true;
					}
				}
				if(flag) continue;
				else x[kk++]=xx;
			}
		}

		printf("%d\n",kk);
	}

//	system("pause");
	return 0;
}


#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <sstream>
#include <cstddef>
#include <algorithm>
#include <utility>
#include <iterator>
#include <numeric>
#include <list>
#include <complex>
#include <cstdio>
#include <climits>
#include <iostream>
#include <fstream>

/*** TEMPLATE CODE STARTS HERE ***/

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef complex<double> pnt;
typedef pair<int, int> pii;

#define RA(x) (x).begin(), (x).end()
#define FE(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define SZ(x) ((int) (x).size())

template<class T>
void splitstr(const string &s, vector<T> &out)
{
    istringstream in(s);
    out.clear();
    copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

static void redirect(int argc, const char **argv)
{
    if (argc > 1)
    {
        static filebuf f;
        f.open(argv[1], ios::in);
        cin.rdbuf(&f);
        if (!cin)
        {
            cerr << "Failed to open '" << argv[1] << "'" << endl;
            exit(1);
        }
    }

    if (argc > 2)
    {
        static filebuf f;
        f.open(argv[2], ios::out | ios::trunc);
        cout.rdbuf(&f);
        if (!cout)
        {
            cerr << "Failed to open '" << argv[2] << "'" << endl;
        }
    }
}

/*** TEMPLATE CODE ENDS HERE */

int main(int argc, const char **argv)
{
    redirect(argc, argv);

    int N;
    cin >> N;
    set<pii> angles;
    for (int i = 0; i < N; i++)
    {
        int K, B;
        cin >> K >> B;
        if (K != 0)
        {
            int g = gcd(K, B);
            K /= g;
            B /= g;
            if (K < 0)
            {
                K = -K;
                B = -B;
            }
            angles.insert(pii(K, B));
        }
    }
    cout << angles.size() << '\n';

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    P[jj++]=(-b[i]*1.0)/(k[i]*1.0);
			    //jj;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
	//int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i]==P[i-1])
				continue;
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];

int main(){
	int k[Max],b[Max];
	double P[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
				P[i]=xx;
		}
		int t=1;
		sort(P,P+n);
		ii=1;
		for(i=1;i<n;i++)
		{
			if(P[i]==P[i-1])
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    P[jj++]=(-b[i]*1.0)/(k[i]*1.0);
			    //jj;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
	//int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{

				if(P[i]>P[i-1]||P[i]<P[i-1])
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
struct node
{
    int k1;
    double point;
    int k2;
}s[100010];
double kp[100010];
int cmp(const void *a, const void *b)
{
    return (*(double *)a - *(double *)b);
}
int main()
{
    int n, k, b;
    int cnt;
    int ans;
    int pk, pb, nk, nb;
    while(scanf("%d", &n) != EOF)
    {
        ans = 0;
        kp[0] = 0;
        cnt = 0;
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &k, &b);
            if(k==0)
            {
                s[i].point = 0;
                s[i].k1 = 0;
                s[i].k2 = 0;
            }
            else if(k > 0) {
                if(b==0) s[i].point=0;
                else s[i].point = -(double)b/(double)k;
                s[i].k1 = 0;
                s[i].k2 = k;
            }
            else if(k < 0) {
                if(b==0) s[i].point=0;
                else s[i].point = -(double)b/(double)k;
                s[i].k1 = k;
                s[i].k2 = 0;
            }
            if(i==0)
            {   kp[cnt++] = s[i].point;  }
            else
            {
                int tag = 0;
                for(int j=0; j<cnt; j++)
                {
                    if(s[i].point == kp[j])
                    {
                        tag = 1;
                        break;
                    }
                }
                if(!tag)
                {
                    kp[cnt++] = s[i].point;
                }
            }
        }
        qsort(kp, cnt, sizeof(kp[0]), cmp);
        for(int i=0; i<cnt; i++)
        {
            nk = 0; nb = 0;
            for(int j=0; j<n; j++)
            {
                if(s[j].point < kp[i])
                {
                    nk += s[j].k2;
                }
                else
                {
                    nk += s[j].k1;
                }
            }
            if(i==0) {
                pk = nk;
            }
            else {
                if(pk != nk)  ans++;
                pk = nk;
            }
        }
        nk = 0;
        for(int j=0; j<n; j++)
        {
            nk += s[j].k2;
        }
        if(pk != nk)  ans++;
        printf("%d\n", ans);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int main(){

	double P[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    xx=(-b[i]*1.0)/k[i];
			    P[jj]=xx;
			    jj++;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i]==P[i-1])
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
//	system("pause");
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          if(k==0&&b!=0){
             continue;
          }
          a[num++]=-(b/k);
      }
      for(int i=0;i<num;i++)
         printf("%.6lf ",a[i]);
      printf("\n");
      sort(a,a+num);
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
     // system("pause");
      return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8

double x[Max],x1[Max];

struct Node{
	double point;
	int l;
	int r;
}P[Max];

int cmp(const void *a,const void *b){
	struct Node c=*(struct Node *)a;
	struct Node d=*(struct Node *)b;
	if(c.point>d.point) return 1;
	else return -1;
}

int main(){
	int k[Max],b[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
			//P[ii].point=(-b[i]*1.0)/k[i];
			bool flag=false;
			for(j=0;j<ii;j++){
				if(fabs(P[ii].point-xx)<=esp){
					flag=1;
					if(k[i]<0){
						P[j].l+=k[i];
					}else{
						P[j].r+=k[i];
					}
					break;
				}
			}
			if(!flag){
				P[ii].point=xx;
				if(k[i]<0) {
					P[ii].l=k[i];
					P[ii].r=0;
					ii++;
				}else{
					P[ii].l=0;
					P[ii].r=k[i];
					ii++;
				}
			}
		}
		printf("%d\n",ii);
	/*	qsort(P,ii,sizeof(P[0]),cmp);
		int ans=0;
		int sum1=0,sum2=0;
		for(i=0;i<ii;i++){
			sum1=0;
			//printf("%f %d %d****\n",P[i].point,P[i].l,P[i].r);
			for(j=0;j<i;j++){
				sum1+=P[j].r;
			//	printf("%d------\n",sum1);
			}
			for(j=i;j<ii;j++) sum1+=P[j].l;

			//printf("%d\n",sum1);
			if(i==0) {sum2=sum1;}
			else{
				if(sum1!=sum2) ans++;
				sum2=sum1;
			}

			//if(fabs(suml-sumr)<=esp ) ans++;
		}
		sum1=0.0;
		for(i=0;i<ii;i++) sum1+=P[i].r;

		if(sum1!=sum2 ) ans++;

		printf("%d\n",ans);*/
	}
//	system("pause");
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
int main()
{
    scanf("%d",&n);
    int i,m=0,ans;
    double b,k;
    for(i=1;i<=n;i++)
    {
        scanf("%lf %lf",&n,&k);
        if(k!=0) a[++m]=-(b/k);
    }
    sort(a+1,a+1+m);
    ans=0;
    for (i=2;i<=m;i++)
    {
        if(fabs(a[i]-a[i-1]>1e-20)) ans++;
    }
    if (m)
    ans++;
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=-b/k;
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>esp)
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include<stdio.h>
#include<algorithm>
using namespace std;
double a[100010];
const double eps=10-20;
int dblcmp(double x){
    if(x<-eps) return -1;
    if(x>eps) return 1;
    return 0;
}
int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        double k,b;
        int l=0;
        for(int i=0;i<n;i++){
            scanf("%lf%lf",&k,&b);
            if(k!=0) a[l++]=0-(b/k);
        }
        sort(a,a+l);
        int ans=0;
        for(int i=1;i<l;i++){
            if(dblcmp(a[i]-a[i-1])!=0) ans++;
        }
        if(l) ans++;
        printf("%d\n",ans);
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=-(b/k);
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>1e-50)
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
long double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          if(k==0&&b!=0){
             continue;
          }
          a[num++]=-(b/k);
      }
      sort(a,a+num);
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
      //system("pause");
      return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     int b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%d %d",&k,&b);
         if(k!=0)
         a[++m]=-(b*1.0)/(k*1.0);
     }
     sort(a+1,a+1+m);
     ans=0;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }
     if (m)
     ans++;
     printf("%d\n",ans);
     return 0;
 }


#include<stdio.h>
#include<stdlib.h>
double s[100010];
int cmp(const void *a, const void *b)
{
    return (*(double *)a - *(double *)b);
}
int main()
{
    int n;
    int k, b;
    while(scanf("%d", &n) != EOF)
    {
        int t=0, ans=0;
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &k, &b);
            if(k!=0)
                s[t++] = -(double)b/(double)k;
        }
        qsort(s, t, sizeof(s[0]), cmp);
        for(int i=1; i<t; i++)
        {
            if(s[i] != s[i-1])
                ans++;
        }
        if(t) ans++;
        printf("%d\n", ans);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
int main()
{
    int i,m=0,ans;
    double b,k;
     while(~scanf("%d",&n))
     {
         m=0;
        for(i=1;i<=n;i++)
        {
            scanf("%lf %lf",&k,&b);
            if(k!=0) a[++m]=-(b/k);
        }
        sort(a+1,a+1+m);
        ans=0;
        for (i=2;i<=m;i++)
        {
            if(fabs(a[i]-a[i-1]>1e-20)) ans++;
        }
        if (m) ans++;
        printf("%d\n",ans);
     }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8
int main(){
	int k[Max],b[Max];
	double x[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,kk=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			//x[i]=(-b[i]*1.0)/k[i];
			if(k[i]!=0)xx=(-b[i]*1.0)/k[i];
			else continue;
			if(kk==0) x[kk++]=xx;
			else{
				bool flag=false;
				for(j=0;j<kk;j++){
					if(fabs(x[j]-xx)<=esp) {
						break;
						flag =true;
					}
				}
				if(flag) continue;
				else x[kk++]=xx;
			}
		}

		printf("%d\n",kk);
	}

//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		//double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    P[jj++]=(-b[i]*1.0)/(k[i]*1.0);
			    //jj;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
	//int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])<=esp)
				continue;
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=-b/k;
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>1e-20)
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include<iostream>
#include<algorithm>
using namespace std;
long double a[100500];
const long double eps=1e-50;
int judge(long double x){
    if(x<-eps) return -1;
    if(x>eps) return 1;
    return 0;
}
int main(){
    int n;
    double k,b;
    int l=0;
      cin>>n;
    for(int i=0;i<n;i++){
        cin>>k>>b;
        if(k!=0) a[l++]=0-(b/k);
    }
    sort(a,a+l);
    int ans=1;
    for(int i=1;i<l;i++){
        if(judge(a[i]-a[i-1])!=0)
            ans++;
    }
    cout<<ans<<endl;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];
int main(){

	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    xx=(-b[i]*1.0)/k[i];
			    P[jj]=xx;
			    jj++;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])<=esp)
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
//	system("pause");
	return 0;
}


#include<stdio.h>
int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        int cnt=0;
        int k,b;
        for(int i=0;i<n;i++){
            scanf("%d%d",&k,&b);
            if(k==0) cnt++;
        }
        printf("%d\n",n-cnt);
    }
}


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     double b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%lf %lf",&k,&b);
         if(k!=0)
         a[++m]=-(b/k);
     }
     sort(a+1,a+1+m);
     ans=0;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }
     if (m)
     ans++;
     printf("%d\n",ans);
     return 0;
 }


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
long double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          if(k==0){
             continue;
          }
          a[num++]=-(b/k);
      }
      sort(a,a+num);
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
      //system("pause");
      return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int a,int b)
{
	if(!x||!y)
	{
		return x>y?x:y;}
		for(int t;t=x%y;x=y,y=t);
		return y;
}
struct
{
	int k;
	int b;
	double x;
} P[Max];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
				int pp=gcd(b[i],k[i]);
			    P[jj].k=k[i]/gcd;
				P[jj].b=b[i]/gcd;
				P[jj++].x=(-b[i]*1.0)/(k[i]*1.0);
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
				ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8
int main(){
	int k[Max],b[Max];
	double x[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,kk=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			//x[i]=(-b[i]*1.0)/k[i];
			if(k[i]!=0)xx=(-b[i]*1.0)/k[i];
			else continue;
			if(k==0) x[kk++]=xx;
			else{
				bool flag=false;
				for(j=0;j<kk;j++){
					if(fabs(x[j]-xx)<=esp) {
						break;
						flag =true;
					}
				}
				if(flag) continue;
				else x[kk++]=xx;
			}
		}

		printf("%d\n",kk);
	}

//	system("pause");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int gcd(int x,int y)
{
	if(!x||!y)return x>y?x:y;
    for(int t;t=x%y;x=y,y=t);
	return y;
}
struct node
{
	int k;
	int b;
	double x;
} P[Max];
int cmp(const void *a,const void *b)
{
	node aa=*(node *)a;
	node bb=*(node *)b;
	int k=aa.x-bb.x;
	if(k<0) return -1;
	else
		   return 1;
}
bool cmp1(node a,node b){
    return a.x<b.x;
}
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else if(b[i]==0){
                P[jj].k=k[i];
				P[jj].b=b[i];
				P[jj++].x=0.0;
			}else{
				int pp=gcd(b[i],k[i]);
			    P[jj].k=k[i]/pp;
				P[jj].b=b[i]/pp;
				P[jj++].x=(-b[i]*1.0)/(k[i]*1.0);
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		//qsort(P,jj,sizeof(P[0]),cmp);
		sort(P,P+jj,cmp1);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i].k!=P[i-1].k||P[i].b!=P[i-1].b)
			ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {
while(~scanf("%d",&n)){
     int i, m = 0, ans;
     double b, k;

     for(i=1;i<=n;i++)
     {
         scanf("%lf %lf",&k,&b);
         if(k!=0)
         a[++m]=-(b/k);
     }
     sort(a+1,a+1+m);
     if(m==1){printf("0\n");
			continue;}
     ans=1;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }

     printf("%d\n",ans);
     }
     return 0;
 }


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
double fabs(double a)
{
    if(a<0)
    return -a;
}
int main()
{
    int i,m=0,ans;
    double b,k;
     while(~scanf("%d",&n))
     {
         m=0;
         for(i=1;i<=n;i++)
    {
        cin>>k>>b;
        if(k!=0) a[++m]=-(b/k);
    }
    sort(a+1,a+1+m);
    ans=0;
    for (i=2;i<=m;i++)
    {
        if(fabs(a[i]-a[i-1]>1e-20)) ans++;
    }
    if (m) ans++;
    cout<<ans<<endl;
     }
    return 0;
}


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 long double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     int b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%d %d",&k,&b);
         if(k!=0)
         a[++m]=-(b*1.0)/(k*1.0);
     }
     sort(a+1,a+1+m);
     ans=0;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }
     if (m)
     ans++;
     printf("%d\n",ans);
     return 0;
 }


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k,b;
int main(){

	double P[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k,&b);
			if(k)
			{
			    P[jj++]=(-b*1.0)/k;
			}
		}

		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>esp)
			   ii++;
		}
		printf("%d\n",ii);
	}
//	system("pause");
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
double P[Max];
int main(){

	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    xx=(-b[i]*1.0)/(k[i]*1.0);
			    P[jj]=xx;
			    jj++;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i]==P[i-1])
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
long double a[V],k,b;
double cmp(double a,double b)
{
   return a-b;
}
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          cin>>k>>b;
          if(k==0&&b!=0){
             continue;
          }
          a[num++]=-(b/k);
      }
    // for(int i=0;i<num;i++)
     //    cout<<a[i];
      //cout<<endl;
      sort(a,a+num,cmp);
     // for(int i=0;i<num;i++)
      //    cout<<a[i];
    //  cout<<endl;
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
    //  system("pause");
      return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8

double x[Max],x1[Max];

struct Node{
	double point;
	int l;
	int r;
}P[Max];

int cmp(const void *a,const void *b){
	struct Node c=*(struct Node *)a;
	struct Node d=*(struct Node *)b;
	if(c.point>d.point) return 1;
	else return -1;
}

int main(){
	int k[Max],b[Max];
	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
			//P[ii].point=(-b[i]*1.0)/k[i];
			bool flag=false;
			for(j=0;j<ii;j++){
				if(fabs(P[ii].point-xx)<=esp){
					flag=1;
					if(k[i]<0){
						P[j].l+=k[i];
					}else{
						P[j].r+=k[i];
					}
					break;
				}
			}
			if(!flag){
				P[ii].point=xx;
				if(k[i]<0) {
					P[ii].l=k[i];
					P[ii].r=0;
					ii++;
				}else{
					P[ii].l=0;
					P[ii].r=k[i];
					ii++;
				}
			}
		}

		qsort(P,ii,sizeof(P[0]),cmp);
		int ans=0;
		//printf("%d\n",ii);
		int sum1=0,sum2=0;
		for(i=0;i<ii;i++){
			sum1=0;
			//printf("%f %d %d****\n",P[i].point,P[i].l,P[i].r);
			for(j=0;j<i;j++){
				sum1+=P[j].r;
			//	printf("%d------\n",sum1);
			}
			for(j=i;j<ii;j++) sum1+=P[j].l;

			//printf("%d\n",sum1);
			if(i==0) {sum2=sum1;}
			else{
				if(sum1!=sum2) ans++;
				sum2=sum1;
			}

			//if(fabs(suml-sumr)<=esp ) ans++;
		}
		sum1=0.0;
		for(i=0;i<ii;i++) sum1+=P[i].r;

		if(sum1!=sum2 ) ans++;

		printf("%d\n",ans);
	}

//	system("pause");
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
long double a[100005];
int main()
{
    int i,m=0,ans;
    double b,k;
     while(~scanf("%d",&n))
     {
         m=0;
         for(i=1;i<=n;i++)
    {
        cin>>k>>b;
        if(k!=0) a[++m]=-(b/k);
    }
    sort(a+1,a+1+m);
    ans=0;
    for (i=2;i<=m;i++)
    {
        if(fabs(a[i]-a[i-1]>1e-20)) ans++;
    }
    if (m) ans++;
    cout<<ans<<endl;
     }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define Max 100010
#define esp 1e-8

double x[Max],x1[Max];

struct Node{
	double point;
	int l;
	int r;
}P[Max];

int cmp(const void *a,const void *b){
	struct Node c=*(struct Node *)a;
	struct Node d=*(struct Node *)b;
	if(c.point>d.point) return 1;
	else return -1;
}
int k[Max],b[Max];
int main(){

	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0;
		double xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			xx=(-b[i]*1.0)/k[i];
				P[i].point=xx;
				if(k[i]<0) {
					P[i].l=k[i];
					P[i].r=0;
				}else{
					P[i].l=0;
					P[i].r=k[i];
				}
		}
		int t=1;
		qsort(P,n,sizeof(P[0]),cmp);
		for(i=0;i<n;i++)
		{
			j=i;
			while(fabs(P[i+1].point-P[j].point)<=esp&&i+1<n)
			{
				P[j].l+=P[i+1].l;
				P[j].r+=P[i+1].r;
				i++;
			}
			if(P[j].l!=P[j].r)
			   ii++;
		}
		printf("%d\n",ii);

	}
//	system("pause");
	return 0;
}


# Include <stdio.h>
 # Include <stdlib.h>
 # Include <string.h>
 # Include <algorithm>
 # Include <iostream>
 # Include <cmath>
 using namespace std;
 int n;
 long double a [100005];
 int main ()
 {
 cin >> n;
 int i, m = 0, ans;
 double b, k;
 for (i = 1; i <= n; i + +)
 {
 cin >> k >> b;
 if (k! = 0) a [+ + m] = - (b / k);
 }
 sort (a +1, a +1 + m);
 ans = 0;
 for (i = 2; i <= m; i + +)
 {
 if (fabs (a [i]-a [i-1]> 1e-20)) ans + +;
 }
 if (m) ans + +;
 cout << ans << endl;
 return 0;
 }


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int n;
double a[100005];
double fabs(double a)
{
    if(a<0)
    return -a;
}
bool cmp(int a,int b)
{
    if(a<b)
    return true;
    else
    return false;
}
int main()
{
    int i,m=0,ans;
    double b,k;
     while(~scanf("%d",&n))
     {
         m=0;
         for(i=1;i<=n;i++)
         {
            cin>>k>>b;
            if(k!=0) a[++m]=-(b/k);
         }
        sort(a+1,a+1+m,cmp);
        ans=0;
        for (i=2;i<=m;i++)
        {
            if(fabs(a[i]-a[i-1]>1e-20)) ans++;
        }
        if (m) ans++;
        cout<<ans<<endl;
    }
        return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int V = 100500;
long double a[V],k,b;
int main()
{
      int n;
      scanf("%d",&n);
      int ans=1;
      int num=0;
      for(int i=0;i<n;i++)
      {
          scanf("%lf %lf",&k,&b);
          if(k==0&&b!=0){
             continue;
          }
          a[num++]=-(b/k);
      }
      sort(a,a+num);
      for(int i=1;i<num;i++)
      {
          if(a[i]!=a[i-1])
             ans++;
      }
      printf("%d\n",ans);
      system("pause");
      return 0;
}


# include <stdio.h>
 # include <stdlib.h>
 # include <string.h>
 # include <algorithm>
 # include <iostream>
 # include <math.h>
 using namespace std;
 int n;
 double a [100005];

 int main ()
 {

     int i, m = 0, ans;
     int b, k;
     scanf("%d",&n);
     for(i=1;i<=n;i++)
     {
         scanf("%d %d",&k,&b);
         if(k!=0)
         a[++m]=-(b*1.0)/(k*1.0);
     }
     sort(a+1,a+1+m);
     ans=0;
     for(i=2;i<=m;i++)
     {
         if(fabs(a[i]-a[i-1])>1e-20)
         ans++;
     }
     if (m)
     ans++;
     printf("%d\n",ans);
     return 0;
 }


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;

int main(){
	double P[Max];
	int n;double k,b;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		for(i=0;i<n;i++){
			scanf("%lf%lf",&k,&b);
			if(k) P[jj++]=-(b/k);
		}
	/*	if(jj==0)
		{
			printf("0\n");
			continue;
		}*/
		sort(P,P+jj);
		ii=0;
		for(i=1;i<jj;i++)
		{
			if(fabs(P[i]-P[i-1])>1e-50)
			   ii++;
		} if(jj)ii++;
		printf("%d\n",ii);
	}
	return 0;
}
/*
1
1 0

3
1 0
0 2
-1 1

3
-2 -4
1 7
-5 1

*/


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<algorithm>
#define Max 100010
#define esp 1e-8
using namespace std;
double x[Max],x1[Max];
int k[Max],b[Max];
int P[Max];
int main(){

	int n;
	while(scanf("%d",&n)!=EOF){
		int i,j,ii=0,jj=0;
		int xx;
		for(i=0;i<n;i++){
			scanf("%d%d",&k[i],&b[i]);
			if(k[i]==0) continue;
			else
			{
			    xx=(-b[i])/k[i];
			    P[jj]=xx;
			    jj++;
			}
		}
		if(jj==0)
		{
			printf("0\n");
			continue;
		}
		int t=1;
		sort(P,P+jj);
		ii=1;
		for(i=1;i<jj;i++)
		{
			if(P[i]==P[i-1])
			{
				continue;
			}
			   ii++;
		}
		printf("%d\n",ii);
	}
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n, total, res, second;
  cin >> n;
  total = 0;
  vector<int> bars(n);
  for (int i = 0; i < n; i++) {
    cin >> bars[i];
    total += bars[i];
  }
  second = 0;
  for (int i = 0; i < n; i++) {
    total -= bars[i];
    if (second >= total) {
      res = i;
      break;
    }
    second += bars[i];
  }

  cout << res << " " << n - res << endl;

  return 0;
}


#include <iostream>
#include <vector>

using namespace std;

main() {
  int n, ares, bres, total, res, second;
  cin >> n;
  vector<int> bars(n);
  for (int i = 0; i < n; i++) {
    cin >> bars[i];
    total += bars[i];
  }
  second = 0;
  for (int i = 0; i < n; i++) {
    total -= bars[i];
    if (second >= total) {
      res = i;
      break;
    }
    second += bars[i];
  }

  cout << res << " " << n - res << endl;

}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n,*A;
	int i,j,suml=0,sumr=0,countl=0,countr=0;
	scanf("%d",&n);
	A=(int*)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",A+i);
	i=0;j=n-1;
	while(j>=i)
	{
		if(suml<sumr)
		{
			suml+=A[i++];
			countl++;
		}
		else if(suml>sumr)
		{
			sumr+=A[j--];
			countr++;
		}
		else if((j)!=(i))
		{
			suml+=A[i++];
			countl++;
			sumr+=A[j--];
			countr++;
		}
		else if((j)==(i))
		{
			countl++;
			i++;
		}
	}
	printf("%d %d",countl,countr);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n,*A;
	int i,j,suml=0,sumr=0,countl=0,countr=0;
	scanf("%d",&n);
	A=(int*)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",A+i);
	i=0;j=n-1;
	while(j>=i)
	{
		if(suml<sumr)
		{
			suml+=A[i++];
			countl++;
		}
		else if(suml>sumr)
		{
			sumr+=A[j--];
			countr++;
		}
		else if((j-1)!=(i+1))
		{
			suml+=A[i++];
			countl++;
			sumr+=A[j--];
			countr++;
		}
		else if((j-1)==(i+1))
			countl++;
//		printf("%d %d\n",suml,sumr);
	}
	printf("%d %d",countl,countr);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n,*A;
	int i,j,suml=0,sumr=0,countl=0,countr=0;
	scanf("%d",&n);
	A=(int*)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",A+i);
	i=0;j=n-1;
	while(j>=i)
	{
		if(suml<sumr)
		{
			suml+=A[i++];
			countl++;
		}
		else if(suml>sumr)
		{
			sumr+=A[j--];
			countr++;
		}
		else if((j)!=(i))
		{
			suml+=A[i++];
			countl++;
			sumr+=A[j--];
			countr++;
		}
		else if((j)==(i))
			countl++;
	}
	printf("%d %d",countl,countr);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n,*A;
	int i,j,suml=0,sumr=0,countl=0,countr=0;
	scanf("%d",&n);
	A=(int*)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",A+i);
	i=0;j=n-1;
	do
	{
		if(suml<sumr)
		{
			suml+=A[i++];
			countl++;
		}
		else if(suml>sumr)
		{
			sumr+=A[j--];
			countr++;
		}
		else if((j-1)!=(i+1))
		{
			suml+=A[i++];
			countl++;
			sumr+=A[j--];
			countr++;
		}
		else
			countl++;
//		printf("%d %d\n",suml,sumr);
	}while(j>=i);
	printf("%d %d",countl,countr);
	return 0;
}


#include<stdio.h>
int main()
{
    int n,a,b,al,bob,i,lo,hi,arr[100005];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&arr[i]);
    }
    lo=0;
    hi=n-1;
    al=0;
    bob=0;
    a=0;b=0;
    while(lo<=hi){
        if(al+arr[lo]<bob+arr[hi]){
            a++;
            al+=arr[lo];
            lo++;
        }
        else if(al+arr[lo]>bob+arr[hi]){
            b++;
            bob+=arr[hi];
            hi--;
        }
        else if(al+arr[lo]==bob+arr[hi] && lo!=hi){
            a++;
            b++;
            al+=arr[lo];
            bob+=arr[hi];
            lo++;
            hi--;
        }
        else{
            a++;
            lo++;
        }
    }
    printf("%d %d\n",a,b);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,a,b,al,bob,i,lo,hi,arr[100005];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&arr[i]);
    }
    lo=0;
    hi=n-1;
    al=0;
    bob=0;
    a=0;b=0;
    while(lo<=hi){
        if(al+arr[lo]<bob+arr[hi]){
            a++;
            al+=arr[lo];
            lo++;
        }
        else if(al+arr[lo]>bob+arr[hi]){
            b++;
            bob+=arr[hi];
            hi--;
        }
        else if(al+arr[lo]==bob+arr[hi] && lo!=hi){
            a++;
            b++;
            lo++;
            hi--;
        }
        else{
            a++;
            lo++;
        }
    }
    printf("%d %d\n",a,b);
    return 0;
}


#include <stdio.h>
#include <stdbool.h>

#define MAX 100000

int main () {
	int bars, Ctime[MAX + 1];
	bool isthere = false; bool done;
	int i, j,k, n;
	int Abars = 0, Bbars = 0;
	int already[MAX + 1];

	scanf ("%d", &bars);

	n = bars;

	for (i = 0; i < n; i++) scanf("%d", &Ctime[i]);

	already[0] = 1;

	for (i = 0, j = n - 1; i < n && j >= 0 && !isthere;){
		done = false;
		if (Ctime[i] > Ctime[j]){
			Ctime[i] -= Ctime[j];
			j--;
			Bbars++;
			if (already[j] == 0)
				already[j] = 2;
			done = true;
		}
		else if (Ctime[i] < Ctime[j]) {
			Abars++;
			Ctime[j] -= Ctime[i];
			i++;
			if (already[i] == 0)
				already[i] = 1;
			done = true;
		}
		if (Ctime[i] == Ctime[j] && i == j - 2) {
			isthere = true;
			done = true;
			Abars+= 2;
			Bbars++;
		}

		else if (Ctime[i] == Ctime[j] && i != j){
			Abars++;
			Bbars++;
			i++; j--;
			done = true;
			if (already[i] == 0)
				already[i] = 1;
			if (already[j] == 0)
				already[j] = 2;
		}

		if (!done) {
			if (i == j && already[i] == 1)
				Abars++;
			else
				Bbars++;
		}

		if ((Abars + Bbars) == bars) isthere = true;

	}

	printf("%d %d\n", Abars, Bbars);
}


#include <stdio.h>
#include <stdbool.h>

#define MAX 100000

int main () {
	int bars, Ctime[MAX + 1];
	bool isthere = false; bool done;
	int i, j,k, n;
	int Abars = 0, Bbars = 0;
	int already[MAX + 1];

	scanf ("%d", &bars);

	n = bars;

	for (i = 0; i < n; i++) scanf("%d", &Ctime[i]);

	already[0] = 1;

	for (i = 0, j = n - 1; i < n && j >= 0 && !isthere;){
		done = false;
		if (Ctime[i] > Ctime[j]){
			Ctime[i] -= Ctime[j];
			j--;
			Bbars++;
			if (already[j] == 0)
				already[j] = 2;
			done = true;
		}
		else if (Ctime[i] < Ctime[j]) {
			Abars++;
			Ctime[j] -= Ctime[i];
			i++;
			if (already[i] == 0)
				already[i] = 1;
			done = true;
		}
		if (Ctime[i] == Ctime[j] && i == j - 2) {
			isthere = true;
			done = true;
			Abars+= 2;
			Bbars++;
		}

		else if (Ctime[i] == Ctime[j] && i != j){
			Abars++;
			Bbars++;
			i++; j--;
			done = true;
		}

		if (!done) {
			if (i == j && already[i] == 1)
				Abars++;
			else
				Bbars++;
		}

		if ((Abars + Bbars) == bars) isthere = true;

	}

	printf("%d %d\n", Abars, Bbars);
}


#include<stdio.h>
int main()
{
  int n,i,sum=0,sum1=0,c=1,c1=1;
  scanf("%d",&n);
  int a[n],k=0,k1=n-1;
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  while(1)
  {
      sum=sum+a[k];
      sum1=sum1+a[k1];
      if(sum<sum1)
        c++;
      else
        c1++;
      if(k==k1)
        break;
     k++;
    k1--;
  }
  printf("%d %d",c,c1);
  return 0;
}


#include<stdio.h>

int main()
{
    long long int n,i,j,a,b,c=2,alice=1,bob=1;
    scanf("%lld",&n);
    int ara[n];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    a=ara[0];b=ara[n-1];
    if(n==1){
        bob=0;b=0;
        c=1;
    }
    for(i=1,j=n-2;c<n;){
        c++;
        if(a<=b){
            a+=ara[i];
            alice++;
            i++;
        }
        else{
            b+=ara[j];
            bob++;
            j--;
        }
    }
    printf("%lld %lld",alice,bob);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n, i;
	int a = 0, b = 0;
	int *cho;
	scanf("%d", &n);
	cho = (int*)malloc(n * sizeof(int));
	for (i = 0; i < n; i++)
		scanf("%d", cho + i);
	int left = 0, right = n - 1;
	while (left <= right)
	{
		if (a + cho[left] > b+cho[right])
		{
				b += cho[right];
				right--;
		}
		else {
			a += cho[left];
			left++;
		}
	}
	printf("%d %d", left,n-left);
	free(cho);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n, i;
	int a = 0, b = 0;
	int *cho;
	scanf("%d", &n);
	cho = (int*)malloc(n * sizeof(int));
	for (i = 0; i < n; i++)
		scanf("%d", cho + i);
	int left = 0, right = n - 1;
	while (left < right)
	{
		if (a + cho[left] > b+cho[right])
		{
				b += cho[right];
				right--;
		}
		else {
			a += cho[left];
			left++;
		}
	}
	printf("%d %d", left,n-left);
	free(cho);
    return 0;
}


#include<stdio.h>
int main()
{
	int a[100000];
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	int forward=0;
	int last=n-1;
	int timefor=0;
	int timeback=0;
	while(forward<=last)
	{
		if(timefor<=timeback)
		while(timefor<=timeback&&forward<=last)
		{
			timefor=timefor+a[forward];
		forward++;
		}
		else
			while(timeback<timefor&&forward<=last)
			{
				timeback=timeback+a[last];
				last--;
			}
	}
	printf("%d %d\n",forward,n-forward);
	return 0;
}


#include<stdio.h>
int main()
{
    int n,choc[100000],ta=0,tb=0,i,j,k,l,m,cea,ceb,sa=0,sb;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&choc[i]);
    }
    sa=0;
    sb=n-1;
    if(n>=2)
    {
        ta+=choc[sa];
        sa++;
        cea=1;
        tb+=choc[sb];
        sb--;
        ceb=1;
    }
    else
    {
        printf("1 0");
        return(0);
    }
    while(1)
    {
        if(cea+ceb==n)
            break;
        if(ta<tb)
        {
            cea++;
            ta+=choc[sa];
            sa++;
        }
        else if(ta>tb)
        {
            ceb++;
            tb+=choc[sb];
            sb--;
        }
        else if(ta==tb)
        {
            cea++;
            ta+=choc[sa];
            sa++;
        }
    }
    printf("%d %d",cea,ceb);
    return(0);
}


#include <stdio.h>
#define MAX 100001
int result, Alice, Bob, start,end;
int chocolate[MAX + 1];

int main()
{
	int loop = 0;
	int i;

	scanf("%d", &loop);
	while (end < loop)
		scanf("%d", &chocolate[end++]);

	while (end > start)
	{
		if (result > 0)
			result -= chocolate[end--];
		else
			result += chocolate[start++];
	}

	printf("%d %d\n", start, loop - start);
	return 0;
}


#include <stdio.h>
#define MAX 100001
int result, Alice, Bob, start,end;
int chocolate[MAX + 1];

int main()
{
	int loop = 0;
	int i;

	scanf("%d", &loop);
	while (end < loop)
		scanf("%d", &chocolate[end++]);

	while (end > start)
	{
		if (result > 0)
			result -= chocolate[--end];
		else
			result += chocolate[start++];
	}

	printf("%d %d\n", start, loop - start);
	return 0;
}


#include <stdio.h>

int r, a, n, i, z[100001];

int main(){

	scanf("%d", &n);

	while (i < n) scanf("%d", &z[i++]);

	while (i > a)
		r > 0 ? r -= z[--i] : r += z[a++];

	printf("%d %d", a, n - a);
}


#include <stdio.h>
#define MAX 1000

int main()
{
	int loop = 0;
	int i;
	int buffer[MAX + 1] = { 0, };
	int bufferLen = 0;
	int start = 0, end = 0;
	int Alice = 0, Bob = 0;
	int flag = 1;
	scanf("%d", &loop);

	for (i = 0; i < loop; i++)
		scanf("%d", &buffer[i]);

	bufferLen = i;
	end = bufferLen;

	while (start < end)
	{
		if (start == end)
		{
			if (flag) Alice++;
			else Bob++;
			break;
		}
		else if (buffer[start] > buffer[end])
		{
			buffer[start] -= buffer[end];
			end--;
			Bob++;
			flag = 0;
		}
		else
		{
			buffer[end] -= buffer[start];
			start++;
			Alice++;
			flag = 1;
		}
	}
	printf("%d %d\n", Alice, Bob);
	return 0;
}


#include <stdio.h>
#define MAX 1000

int main()
{
	int loop = 0;
	int i;
	int buffer[MAX + 1] = { 0, };
	int bufferLen = 0;
	int start = 0, end = 0;
	int Alice = 0, Bob = 0;
	int flag = 1;
	scanf("%d", &loop);

	for (i = 0; i < loop; i++)
		scanf("%d", &buffer[i]);

	bufferLen = i;
	end = bufferLen;

	while (start < end)
	{
		if (start == end)
		{
			if (!flag) Alice++;
			else Bob++;
			break;
		}
		else if (buffer[start] > buffer[end])
		{
			buffer[start] -= buffer[end];
			end--;
			Bob++;
			flag = 0;
		}
		else
		{
			buffer[end] -= buffer[start];
			start++;
			Alice++;
			flag = 1;
		}
	}
	printf("%d %d\n", Alice, Bob);
	return 0;
}


#include <stdio.h>
#define MAX 100001
int result, Alice, Bob, start,end;
int chocolate[MAX + 1];

int main()
{
	int loop = 0;
	int i;

	scanf("%d", &loop);
	for (end = 0; end < loop; end++)
		scanf("%d", &chocolate[end]);

	while (end > start)
	{
		if (result > 0)
			result -= chocolate[end--];
		else
			result += chocolate[start++];
	}

	printf("%d %d\n", start, loop - start);
	return 0;
}


#include <stdio.h>
#define MAX 1000

int main()
{
	int loop = 0;
	int i;
	int buffer[MAX + 1] = { 0, };
	int bufferLen = 0;
	int start = 0, end = 0;
	int Alice = 0, Bob = 0;
	int flag = 1;
	scanf("%d", &loop);

	for (i = 0; i < loop; i++)
		scanf("%d", &buffer[i]);

	end = i-1;

	while (start <= end)
	{
		if (start == end)
		{
			if (flag) Alice++;
			else Bob++;
			break;
		}
		else if (buffer[start] > buffer[end])
		{
			buffer[start] -= buffer[end];
			end--;
			Bob++;
			flag = 1;
		}
		else
		{
			buffer[end] -= buffer[start];
			start++;
			Alice++;
			flag = 0;
		}
	}
	printf("%d %d\n", Alice, Bob);
	return 0;
}


#include <stdio.h>
#define MAX 1000

int main()
{
	int loop = 0;
	int i;
	int buffer[MAX + 1] = { 0, };
	int bufferLen = 0;
	int start = 0, end = 0;
	int resultOfstart = 0, resultOfend = 0;
	int flag = 0;
	scanf("%d", &loop);

	for (i = 0; i < loop; i++)
		scanf("%d", &buffer[i]);

	bufferLen = i;
	end = bufferLen - 1;

	while (1)
	{
		if (buffer[start] > buffer[end])
		{
			buffer[start] -= buffer[end];
			end--;
			resultOfend++;
			flag = 0;
		}
		else if (buffer[end] > buffer[start])
		{
			buffer[end] -= buffer[start];
			start++;
			resultOfstart++;
			flag = 1;
		}
		else
		{
			if (!flag)
				resultOfstart++;
			else
				resultOfend++;
			break;
		}
	}

	printf("%d %d\n", resultOfstart, resultOfend);

	return 0;
}


#include <stdio.h>
#define MAX 100000
int buffer[MAX + 1] = { 0, };

int main()
{
	int loop = 0;
	int i;

	int bufferLen = 0;
	int start = 0, end = 0;
	int Alice = 0, Bob = 0;
	int flag = 1;
	scanf("%d", &loop);

	for (i = 0; i < loop; i++)
		scanf("%d", &buffer[i]);

	end = i-1;

	while (start <= end)
	{
		if (start == end)
		{
			if (flag) Alice++;
			else Bob++;
			break;
		}
		else if (buffer[start] > buffer[end])
		{
			buffer[start] -= buffer[end];
			end--;
			Bob++;
			flag = 1;
		}
		else
		{
			buffer[end] -= buffer[start];
			start++;
			Alice++;
			flag = 0;
		}
	}
	printf("%d %d\n", Alice, Bob);
	return 0;
}


#include<stdio.h>
int main(){
int n,i=1,j;
scanf("%d",&n);
int a[n],sum1,sum2;
for(i=0;i<n;i++)
    scanf("%d",&a[i]);
sum1=a[0];sum2=a[n-1];
i=1;j=n-2;
while(i<j){
        //printf("%d %d\n",sum1,sum2);
    if(sum1<sum2){
        sum1=sum1+a[i];
        i++;
    }
    else if(sum1>sum2){
        sum2=sum2+a[j];
        j--;
    }
    else{
        sum1=sum1+a[i];
        i++;
        //printf("%d ",i);
        sum2=sum2+a[j];
        j--;
    }
}
if((i==j)){
    if(sum1==sum2){
    i++;
    printf("%d %d",i,n-i);
    }
    else if(sum1<sum2){
        i++;printf("%d %d",i,n-i);
    }
    else{
        if(sum1>sum2){
            printf("%d %d",i,n-i);
        }
    }
}
else
printf("%d %d",i,n-i);
return 0;
}


#include<stdio.h>
int main(){
int n,i=1,j;
scanf("%d",&n);
int a[n],sum1,sum2;
for(i=0;i<n;i++)
    scanf("%d",&a[i]);
sum1=a[0];sum2=a[n-1];
i=1;j=n-2;
while(i<j){
        //printf("%d %d\n",sum1,sum2);
    if(sum1<sum2){
        sum1=sum1+a[i];
        i++;
    }
    else if(sum1>sum2){
        sum2=sum2+a[j];
        j--;
    }
    else{
        sum1=sum1+a[i];
        i++;
        //printf("%d ",i);
        sum2=sum2+a[j];
        j--;
    }
}
if((sum1==sum2)&&(i==j)){
    i++;
    printf("%d %d",i,n-i);
}
else
printf("%d %d",i,n-i);
return 0;
}


#include<stdio.h>
int main(){
int n,i=1,j;
scanf("%d",&n);
int a[n],sum1,sum2;
for(i=0;i<n;i++)
    scanf("%d",&a[i]);
sum1=a[0];sum2=a[n-1];
i=1;j=n-2;
while(i<j){
        //printf("%d %d\n",sum1,sum2);
    if(sum1<sum2){
        sum1=sum1+a[i];
        i++;
    }
    else if(sum1>sum2){
        sum2=sum2+a[j];
        j--;
    }
    else{
        sum1=sum1+a[i];
        i++;
        //printf("%d ",i);
        sum2=sum2+a[j];
        j--;
    }
}
if((sum1=sum2)&&(i==j)){
    i++;
    printf("%d %d",i,n-i);
}
else
printf("%d %d",i,n-i);
return 0;
}


#include <stdio.h>
#include <math.h>
int main()
{
	int n,i;
	double  sum=0,x;
	double a[100000];
	scanf ("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf ("%lf",&a[i]);
		sum=sum+a[i];
	}
	sum=sum/2;
	x=sum;
	for (i=0;i<n;i++)
	{
		sum=sum-a[i];
		if (sum<0)break;
	}
	if (fabs(sum)<=a[i]/2)
		printf ("%d %d\n",i+1,n-1-i);
	else if (fabs(sum)>(a[i]/2))
	    printf ("%d %d\n",i,n-i);
	return 0;
}


#include <stdio.h>
int count(long long int left,long long int  right,int i,int t[],int n)
{
    if(left>=right)
        return i;
    if(left<right)
        {if(i+1==n)
          return i;
        return count(left+t[i],right-t[i+1],i+1,t,n);
        }

}

int main(void) {
    // your code goes here
    int n,i,x;
    long long right=0;
    scanf("%d",&n);
    int t[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&t[i]);
        right+=t[i];
    }
    right-=t[0];
    x=count(0,right,0,t,n);
    printf("%d %d",x,n-x);
    return 0;
}


#include <stdio.h>
int count(long long int left,long long int  right,int i,int t[],int n)
{
    if(left>right)
        return i;
    if(left==right)
        return i+1;
    if(left<right)
        {if(i+1==n)
          return n;
        return count(left+t[i],right-t[i+1],i+1,t,n);
        }

}

int main(void) {
    // your code goes here
    int n,i,x;
    long long right=0;
    scanf("%d",&n);
    int t[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&t[i]);
        right+=t[i];
    }
    right-=t[0];
    x=count(0,right,0,t,n);
    printf("%d %d",x,n-x);
    return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int g=0;
	long long int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	if(n>1)
		while((bob+mar)<n)
		{
			if(bobm<marm)
			{
				k++;
				bobm=bobm+a[k];
				bob++;
			}
			else if(bobm>marm)
			{
				g++;
				marm=marm+a[n-1-g];
				mar++;
			}
			else if(bobm==marm&&(bob+mar)!=n-1)
			{
				k++;
				bobm=bobm+a[k];
				bob++;
				g++;
				marm=marm+a[n-1-g];
				mar++;
			}
			else if(bobm==marm&&(bob+mar)==n-1)
			{
				k++;
				bobm=bobm+a[k];
				bob++;
			}
		}
	else if(n==1)
	{
		bob=1;
		mar=0;
	}
	printf("%lld %lld \n",bob,mar);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int g=0;
	long long int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<marm)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)!=n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)==n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
	}
	printf("%lld %lld \n",bob,mar);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	p=n%2;
	int g=0;
	int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<=marm&&(bob+mar)!=n-2)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)==n-2)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
	}
	printf("%d %d\n",bob,mar);
	//printf("%d %d\n",bobm,marm);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	p=n%2;
	int g=0;
	int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<=marm)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
	}
	printf("%d %d\n",bob,mar);
	//printf("%d %d\n",bobm,marm);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	p=n%2;
	int g=0;
	int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<marm)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)!=n-2)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm==marm&&(bob+mar)==n-2)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
	}
	printf("%d %d\n",bob,mar);
	//printf("%d %d\n",bobm,marm);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int g=0;
	long long int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<marm)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)!=n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)==n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
	}
	printf("%lld %lld\n",bob,mar);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i=0,j=0,k=0,p=0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int g=0;
	int bob=1,bobm=a[k],mar=1,marm=a[n-1-g];
	while((bob+mar)<n)
	{
		if(bobm<marm)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
		else if(bobm>marm)
		{
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)!=n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
			g++;
			marm=marm+a[n-1-g];
			mar++;
		}
		else if(bobm==marm&&(bob+mar)==n-1)
		{
			k++;
			bobm=bobm+a[k];
			bob++;
		}
	}
	printf("%d %d\n",bob,mar);
	return 0;
}


#include <stdio.h>

main() {
    int n, i, j;
    int astarted=0, bstarted=0;
    scanf("%d", &n);
    int data[n];
    for (i = 0; i < n; i++) scanf("%d", &data[i]);

    int supramacy = 0;
    i = 0; j = n - 1;
    while (i <= j) {
        if (i == j) { if (supramacy) j--; else i++; break; }

        if (data[i] < data[j]) { data[j] -= data[i]; i++; supramacy = 1;}
        else if (data[i] > data[j]) { data[i] -= data[j]; j--; supramacy = 0;}
        else { i++; j--; supramacy = 0;}
    }
    printf("%d %d", i, n - 1 - j);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

typedef int bool;
#define TRUE 1
#define FALSE 0

int main(int argc, char *argv[]) {
    int numChocs;
    scanf("%d\n", &numChocs);

    int *chocs;
    chocs = (int *) malloc(sizeof(int) * numChocs);

    if (numChocs > 0)
        scanf("%d", chocs);

    for (int i = 1; i < numChocs; ++i) {
        scanf(" %d", chocs + i);
    }

    int *alice = chocs;
    int acount = 0;

    int *bob = chocs + numChocs - 1;
    int bcount = 0;
    bool bobStarted = FALSE;

    while (alice < bob) {
        int min = (*alice < *bob) ? *alice : *bob;

        *alice -= min;
        *bob -= min;
        if (*alice == 0) {
            ++alice;
            ++acount;
        }
        if (*bob == 0) {
            --bob;
            ++bcount;
            bobStarted = FALSE;
        }
        else
            bobStarted = TRUE;
    }

    if (*alice && !bobStarted) {
        ++acount;
        *alice = 0;
    }
    if (*bob) {
        ++bcount;
        *bob = 0;
    }

    printf("%d %d\n", acount, bcount);
}


#include <stdio.h>
#include <stdlib.h>

typedef int bool;
#define TRUE 1
#define FALSE 0

int main(int argc, char *argv[]) {
    int numChocs;
    scanf("%d\n", &numChocs);

    int *chocs;
    chocs = (int *) malloc(sizeof(int) * numChocs);

    if (numChocs > 0)
        scanf("%d", chocs);

    int i;
    for (i = 1; i < numChocs; ++i) {
        scanf(" %d", chocs + i);
    }

    int *alice = chocs;
    int acount = 0;

    int *bob = chocs + numChocs - 1;
    int bcount = 0;
    bool bobStarted = FALSE;

    while (alice < bob) {
        int min = (*alice < *bob) ? *alice : *bob;

        *alice -= min;
        *bob -= min;
        if (*alice == 0) {
            ++alice;
            ++acount;
        }
        if (*bob == 0) {
            --bob;
            ++bcount;
            bobStarted = FALSE;
        }
        else
            bobStarted = TRUE;
    }

    if (*alice && !bobStarted) {
        ++acount;
        *alice = 0;
    }
    if (*bob) {
        ++bcount;
        *bob = 0;
    }

    printf("%d %d\n", acount, bcount);
}


#include <stdio.h>
    int num[100002];
int main()
{
    int n,p1,p2;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        scanf("%d",num+i);
    p1=1;
    p2=n;
    for(int sum1=0,sum2=0;p1<=p2;)
    {
        if(sum1<=sum2)
            sum1+=num[p1++];
        else
            sum2+=num[p2--];
    }
    printf("%d %d",p1-1,n-p2);
    return 0;
}


#include<stdio.h>

int main()
{
    long n, i, total=0, at=0, an=0, bt=0, bn=0;
    scanf("%ld", &n);
    long times[n];
    for(i=0;i<n;i++){
        scanf("%ld", &times[i]);
        total+=times[i];
    }
    for(i=0;i<n;i++){
        if(2*(at+times[i])<=total){
            at+=times[i];
            ++an;
        }
        else
            break;
    }
    for(i=n-1;i>=0;i--){
        if(2*(bt+times[i])<=total){
            bt+=times[i];
            ++bn;
        }
        else
            break;
    }
    if(an+bn<n){
        (at<=bt)?(++an):(++bn);
    }
    printf("%ld %ld", an , bn);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,*t,i,j,count=0,count2=0;
    long long int sum_a=0,sum_b=0;
    scanf("%d",&n);
    t=(int*)calloc(n,sizeof(int));
    for(i=0;i<n;i++){
        scanf("%d",&t[i]);
    }
    for(i=0,j=n-1;i<n;i++){
        if(sum_a<=sum_b){
            sum_a=sum_a+t[count];
            count++;
        }
        else if(sum_b<sum_a){
            sum_b=sum_b+t[j];
            j--;
            count2++;
        }
    }
    printf("%d %d\n",count,count2);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,*a,i,alice,bob,j;
	scanf("%d",&n);
	a=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	alice=0;bob=0;
	i=0;j=n-1;
	while(j-i>1)
	{
		if(a[i]>a[j])
		{
			a[i]=a[i]-a[j];
			j--;
			bob++;
		}
		else if(a[i]<a[j])
		{
			a[j]=a[j]-a[i];
			i++;
			alice++;
		}
		else
		{
			i++;
			j--;alice++;bob++;
		}
	}
	alice++;
	if(i!=j)
		bob++;
	printf("%d %d\n",alice,bob);
	return 0;
}


#include<stdio.h>
int main()
{
	long long int n,a[100000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
			bt=bt+a[j];
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%lld %lld\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[1000000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
		{
			bt=bt+a[j];
			if(bt>at)
				break;
		}
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	long long int n,a[100000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
		{
			bt=bt+a[j];
			if(bt>at)
				break;
		}
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%lld %lld\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[100000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
			bt=bt+a[j];
		if(at>bt)
			bc++;
		else
			ac++;
	}
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[100000],ac=0,bc=0,at=0,bt=0,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
	{
		bt=0;
		at=at+a[i];
		for(j=n-1;j>=i;j--)
		{
			bt=bt+a[j];
			if(bt>at)
				break;
		}
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[100000],ac=0,bc=0,at=0,bt=0,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
	{
		bt=0;
		at=at+a[j];
		for(j=n-1;j>=i;j--)
		{
			bt=bt+a[j];
			if(bt>at)
				break;
		}
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%d %d\n",ac-1,bc+1);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[10000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
			bt=bt+a[j];
		if(at>bt)
			bc++;
		else
			ac++;
	}
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[100000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
			bt=bt+a[j];
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,a[100000],ac=0,bc=0,at,bt,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
	{
		at=bt=0;
		for(j=0;j<=i;j++)
			at=at+a[j];
		for(j=n-1;j>=i;j--)
		{
			bt=bt+a[j];
			if(bt>at)
				break;
		}
		if(at>bt)
			break;
		else
			ac++;
	}
	bc=n-ac;
	printf("%d %d\n",ac,bc);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int t[100001],sum[100001];
int main(){
	int i,j,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&t[i]);
		sum[i]=sum[i-1]+t[i];
	}
	if(n==1) printf("1 0");
	for(i=1;i<=n;i++){
		if(sum[i-1]>sum[n]-sum[i]){
			printf("%d %d",i-1,n-i+1);
			break;
		}
	}
	return 0;
}


#include<stdio.h>
int a,d[100005],w[100005],s,m,bas,son,alice,bob,i,j;
int main(){
	scanf("%d",&a);
	for(i=1; i<=a; i++) scanf("%d",&d[i]);
	bas=1;
	son=a;
	while(bas<=son){
		s++;
		if(bas>son)
			break;
	  	if(d[bas] < d[son]){
			d[son]-=d[bas];
			bas++;
			alice++;
			w[son] = 2;

		}
		else if(d[bas] > d[son]){
			d[bas]-=d[son];
			son--;

			bob++;
			w[bas]=1;
		}
		else if(d[bas] == d[son] && son != bas){
			bas++;
			son--;
			alice++;
			bob++;
		}
		else if(bas == son ){
			if(w[bas]==2){
				bob++;
				break;
			}
			else{
				alice++;
				break;
			}
	}

	}
		printf("%d %d",alice,bob);

	return 0;
}


#include<stdio.h>
int main()
{
int n,i,prev,alice[100000],bob[100000],alicechoc,bobchoc;
int *arr;
scanf("%d",&n);
arr=(int*)malloc(sizeof(int)*n);
for(i=0;i<=n-1;i++)
{
scanf("%d",&arr[i]);
}
if(n==1)
{
printf("1 0");
exit(0);
}
if(n==2)
{
printf("1 1");
exit(0);
}

prev=0;
for(i=0;i<=n-1;i++)
{
alice[i]=arr[i]+prev;
prev=alice[i];
}prev=0;
for(i=n-1;i>=0;i--)
{
bob[i]=arr[i]+prev;
prev=bob[i];
}
if(n==3)
{
if(alice[0]>bob[0])
{
printf("1 2");
exit(0);
}
else
{
printf("2 1");
}
}
alicechoc=n-1;
bobchoc=1;
for(i=n-2;i>=1;i--)
{
if(alice[i-1]>bob[i+1])
{
bobchoc++;
alicechoc--;
}
else
{
break;
}
}
printf("%d %d",alicechoc,bobchoc);
return(0);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <cassert>
#include <ctime>
#include <sstream>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define sc(x) scanf("%d", &x)
#define sc2(x, y) scanf("%d%d", &x, &y)
#define pr(x) printf("%d ", x)
#define nl() printf("\n")
#define mp(x, y) make_pair(x, y)
#define forn(i, a, b) for(int i=a; i<b; ++i)
#define ford(i, a, b) for(int i=b-1; i>=a; --i)
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define X first
#define Y second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld EPS = 1e-9;

#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

struct SegmentTree {
	vector<unordered_map<int, int> > data;
	const int DELTA = 1 << 20;

	SegmentTree() {
		data.resize(DELTA << 1);
	}

	void update(int pos, int x, int delta)
	{
		pos += DELTA;
		while(pos>0)
		{
			data[pos][x] += delta;
			pos >>= 1;
		}
	}

	int getAns(int t, int x)
	{
		return getAns(1, 0, DELTA - 1, 0, t, x);
	}

	int getAns(int u, int curL, int curR, int queryL, int queryR, int x)
	{
		if (queryL > queryR) return 0;
		if (curL == queryL && curR == queryR) return data[u][x];
		int mid = (curL + curR) >> 1;
		return getAns(u << 1, curL, mid, queryL, min(queryR, mid), x)
			+ getAns((u << 1) + 1, mid + 1, curR, max(mid + 1, queryL), queryR, x);
	}
};

struct Query
{
	int a, t, x;

	void scan()
	{
		scanf("%d %d %d", &a, &t, &x);
	}
};

SegmentTree tree;
Query queries[1000005];
int times[1000005];

void solve()
{
	int n;
	sc(n);

	for (int i = 0; i < n; ++i)
	{
		queries[i].scan();
		times[i] = queries[i].t;
	}
	sort(times, times + n);
	unordered_map<int, int> realPos;
	for (int i = 0; i < n; ++i)
		realPos[times[i]] = i;
	for (int i = 0; i < n; ++i)
	{
		switch(queries[i].a)
		{
		case 1:
			tree.update(realPos[queries[i].t], queries[i].x, +1);
			break;
		case 2:
			tree.update(realPos[queries[i].t], queries[i].x, -1);
			break;
		case 3:
			printf("%d\n", tree.getAns(realPos[queries[i].t], queries[i].x));
			break;
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
#endif
	solve();

	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <cassert>
#include <ctime>
#include <sstream>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define sc(x) scanf("%d", &x)
#define sc2(x, y) scanf("%d%d", &x, &y)
#define pr(x) printf("%d ", x)
#define nl() printf("\n")
#define mp(x, y) make_pair(x, y)
#define forn(i, a, b) for(int i=a; i<b; ++i)
#define ford(i, a, b) for(int i=b-1; i>=a; --i)
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define X first
#define Y second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld EPS = 1e-9;

#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;
const int DELTA = 1 << 17;

struct SegmentTree {
	vector<unordered_map<int, int> > data;

	SegmentTree() {
		data.resize(DELTA << 1);
	}

	void update(int pos, int x, int delta)
	{
		pos += DELTA;
		while(pos>0)
		{
			data[pos][x] += delta;
			pos >>= 1;
		}
	}

	int getAns(int t, int x)
	{
		return getAns(1, 0, DELTA - 1, 0, t, x);
	}

	int getAns(int u, int curL, int curR, int queryL, int queryR, int x)
	{
		if (queryL > queryR) return 0;
		if (curL == queryL && curR == queryR) return data[u][x];
		int mid = (curL + curR) >> 1;
		return getAns(u << 1, curL, mid, queryL, min(queryR, mid), x)
			+ getAns((u << 1) + 1, mid + 1, curR, max(mid + 1, queryL), queryR, x);
	}
};

struct Query
{
	int a, t, x;

	void scan()
	{
		scanf("%d %d %d", &a, &t, &x);
	}
};

SegmentTree tree;
Query queries[1<<17];
int times[1<<17];

void solve()
{
	int n;
	sc(n);

	for (int i = 0; i < n; ++i)
	{
		queries[i].scan();
		times[i] = queries[i].t;
	}
	sort(times, times + n);
	unordered_map<int, int> realPos;
	for (int i = 0; i < n; ++i)
		realPos[times[i]] = i;
	for (int i = 0; i < n; ++i)
	{
		switch(queries[i].a)
		{
		case 1:
			tree.update(realPos[queries[i].t], queries[i].x, +1);
			break;
		case 2:
			tree.update(realPos[queries[i].t], queries[i].x, -1);
			break;
		case 3:
			printf("%d\n", tree.getAns(realPos[queries[i].t], queries[i].x));
			break;
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
#endif
	solve();

	return 0;
}


#pragma comment (linker, "/STACK:256000000")

#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>
#include <complex>
#include <unordered_set>
#include <unordered_map>
//#include <random>

using namespace std;

typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef double ldouble;
typedef pair<int64, int64> pii;
typedef pair<int64, int64> pll;
typedef pair<pii, pii> piiii;

#define pb push_back
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define rand32() (((unsigned int)(rand()) << 16) | (unsigned int)(rand()))
#define rand64() (((unsigned int64)(rand32()) << 16) | (unsigned int64)(rand32()))
#define bit(mask, b) ((mask >> b) & 1)
#define biton(mask, bit) (mask | (((uint64)(1)) << bit))
#define bitoff(mask, bit) (mask & (~(((uint64)(1)) << bit)))
#define bitputon(mask, bit) (mask |= (((uint64)(1)) << bit))
#define bitputoff(mask, bit) (mask &= (~(((uint64)(1)) << bit)))
#define FAIL() (*((int*)(0)))++
#define INF ((int)(1e9) + 1337)
#define LINF ((int64)(1e18))
#define EPS (1e-7)
#define PI (3.1415926535897932384626433832795)
#define y1 yy1
#define y0 yy0
#define j0 jj0

//#define HMOD (1000000000000000003LL)
//#ifdef _MY_DEBUG
//#define HMOD 1000000007
//#endif
//#define HBASE 524287
const int MAXN = 1000100;
//mt19937 ggen;
int q = 0, qq, n;
int mn[2];
int pos[MAXN];
struct quer
{
	int a, t, x;
	int pos;
};
quer que[MAXN];
map <int, int> xz;
vector < vector < pii > > ms;
vector < vector < int > > fen;

void add(vector < int >& fn, int pos, int val)
{
	for(int i = pos; i < fn.size(); i |= i + 1)
	{
		fn[i] += val;
	}
}

int sum(vector < int >& fn, int pos)
{
	int ans = 0;
	for(int i = pos; i >= 0; i = (i & (i + 1)) - 1)
	{
		ans += fn[i];
	}
	return ans;
}

void solve()
{
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d %d %d", &que[i].a, &que[i].t, &que[i].x);
		xz[que[i].x];
	}
	int k = 0;
	for(auto it = xz.begin(); it != xz.end(); ++it)
		(*it).second = k++;
	ms.resize(k);
	fen.resize(k);
	for(int i = 0; i < n; ++i)
	{
		int x = xz[que[i].x];
		ms[x].push_back(pii(que[i].t, i));
	}
	for(int i = 0; i < ms.size(); ++i)
	{
		sort(ms[i].begin(), ms[i].end());
		for(int j = 0; j < ms[i].size(); ++j)
		{
			que[ms[i][j].second].pos = j;
		}
		fen[i].resize(ms[i].size());
	}

	for(int i = 0; i < n; ++i)
	{
		int x = xz[que[i].x];
		if (que[i].a != 3)
		{
			add(fen[x], que[i].pos, (que[i].a == 1 ? 1 : -1));
		}
		else
		{
			printf("%d\n", sum(fen[x], que[i].pos));
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _MY_DEBUG
    freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#else
    //freopen(TASK ".in", "rt", stdin); freopen(TASK ".out", "wt", stdout);
#endif
    srand(1313);

	solve();

    return 0;
}


#pragma comment(linker, "/STACK:134217728")
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <complex>
#include <functional>
#include <cmath>
#include <time.h>

using namespace std;

typedef long long LL;

int n;

int a[100000];
int t[100000];
int x[100000];

map<int, int> D;
map<int, int> M[100000];

vector<int> pos[100000];
vector<int> Q[100000];

void add(int pos, int x, vector<int> & Q)
{
	int N = Q.size() / 2;
	pos += N;
	while (pos)
	{
		Q[pos] += x;
		pos >>= 1;
	}
}

int sum(int L, int R, vector<int> & Q)
{
	int res = 0;
	int N = Q.size() / 2;
	for (L += N, R += N; L < R; L >>= 1, R >>= 1)
	{
		if (L & 1)
			res += Q[L++];
		if (R & 1)
			res += Q[--R];
	}
	return res;
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d%d%d", &a[i], &t[i], &x[i]);
		if (!D.count(x[i]))
			D[x[i]] = D.size();
		x[i] = D[x[i]];
		pos[x[i]].push_back(t[i]);
	}

	int m = D.size();

	for (int i = 0; i < m; ++i)
	{
		sort(pos[i].begin(), pos[i].end());
		for (int j = 0; j < pos[i].size(); ++j)
		{
			if (!M[i].count(pos[i][j]))
				M[i][pos[i][j]] = M[i].size();
			pos[i][j] = M[i][pos[i][j]];
		}
		Q[i].resize(2 * pos[i].size(), 0);
	}

	for (int i = 0; i < n; ++i)
	{
		if (a[i] == 1)
			add(M[x[i]][t[i]], 1, Q[x[i]]);
		else if (a[i] == 2)
			add(M[x[i]][t[i]], -1, Q[x[i]]);
		else
			printf("%d\n", sum(0, M[x[i]][t[i]], Q[x[i]]));
	}

	return 0;
}


#include <iostream>
#include <map>

using namespace std;

const int min = 1e9 + 1;

int main()
{
	map<int, map<int, int> > mymap;
	int n, a, t, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> t >> x;
		while (t < min)
		{
			if (a == 1)
				//while (t <min)
			{
				mymap[x][t]++;
				t += (t & -t);
			}
			if (a == 2)
				//while (t < min)
			{
				mymap[x][t]--;
				t += (t & -t);
			}
			if (a == 3)
			{
				for (x1 = 0; t > 0; t -= (t & -t))
					x1 += mymap[x][t];
				cout << x1 << endl;
			}
		}

	}

}


#include <iostream>
#include <map>

using namespace std;

const int min = 1e9 + 1;

int main()
{
	map<int, map<int, int> > mymap;
	int n, a, t, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> t >> x;
		if (a == 1)
			while (t <min)
			{
				mymap[x][t]++;
				t += (t & -t);
			}
		if (a == 2)
			while (t < min)
			{
				mymap[x][t]--;
				t += (t & -t);
			}
		if (a == 3)
		{
			for (x1 = 0; t > 0; t -= (t & -t))
				x1 += mymap[x][t];
		}
		cout << x1 << endl;
	}

}


#include <iostream>
#include <map>

using namespace std;

const int min = 1e9 + 1;

int main()
{
	map<int, map<int, int> > mymap;
	int n, a, t, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> t >> x;

		{
			if (a == 1)
				while (t <min)
			{
				mymap[x][t]++;
				t += (t & -t);
			}
			if (a == 2)
				while (t < min)
			{
				mymap[x][t]--;
				t += (t & -t);
			}
			if (a == 3)
			{
				for (x1 = 0; t > 0; t -= (t & -t))
					x1 += mymap[x][t];
				cout << x1 << endl;
			}
		}

	}

}


#include <iostream>
#include <map>

using namespace std;

const int min = 1e9 + 1;

int main()
{
	map<int, map<int, int> > mymap;
	int n, a, t, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> t >> x;
		while (t < min)
		{
			if (a == 1)
				//while (t <min)
			{
				mymap[x][t]++;
				t += (t & -t);
			}
			if (a == 2)
				while (t < min)
				{
					mymap[x][t]--;
					t += (t & -t);
				}
			if (a == 3)
			{
				for (x1 = 0; t > 0; t -= (t & -t))
					x1 += mymap[x][t];
			}
		}
		cout << x1 << endl;
	}

}


#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <map>

using namespace std;
map<int, map<int, int>>mymap;
void main()
{

	int m = 1000000001;
	int n, a, time, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> time >> x;
		if (a == 1)
		{
			for (; time < m;)
			{
				mymap[x][time]++;
				time += (time & -time);
			}
		}
		if (a == 2)
		{
			for (; time < m;)
			{
				mymap[x][time]--;
				time += (time & -time);
			}
		}
		if (a == 3)
		{
			for (x1 = 0; time > 0; time -= (time & -time))
				x1 += mymap[x][time];
			cout << x1 << endl;
		}

	}
}


#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <map>

using namespace std;

void main()
{

	map<int, map<int, int>>mymap;
	int m = 1000000001;
	int n, a, time, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> time >> x;
		if (a == 1)
		{
			while (time < m)
			{
				mymap[x][time]++;
				time += (time & -time);
			}
		}
		if (a == 2)
		{
			 while (time < m)
			{
				mymap[x][time]--;
				time += (time & -time);
			}
		}
		if (a == 3)
		{
			for (x1 = 0; time > 0; time -= (time & -time))
				x1 += mymap[x][time];
			cout << x1 << endl;
		}

	}
}


#include <iostream>
#include <map>

using namespace std;

const int min = 1e9 + 1;

int main()
{
	map<int, map<int, int> > mymap;
	int n, a, t, x, x1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> t >> x;
		//while (t < min)
		{
			if (a == 1)
				//while (t <min)
			{
				mymap[x][t]++;
				t += (t & -t);
			}
			if (a == 2)
				while (t < min)
				{
					mymap[x][t]--;
					t += (t & -t);
				}
			if (a == 3)
			{
				for (x1 = 0; t > 0; t -= (t & -t))
					x1 += mymap[x][t];
			}
		}
		cout << x1 << endl;
	}

}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stack>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <set>
#include <iterator>
#include <memory.h>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <ctime>
#include <cassert>

using namespace std;

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mp(a, b) make_pair(a, b)
#define sqr(x) ( (x) * (x) )
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define ft first
#define sc second

typedef long long li;
typedef double ld;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
typedef pair<int, int> pt;

const int INF = 1e9;
const li INF64 = 1e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-8;
const int MOD = 1000000007;
const int N = 100010;

int n;
pair<int, pii> q[N];
set<int> a[N];
vi b[N], f[N];

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

	scanf("%d", &n);
	forn(i, n) scanf("%d%d%d", &q[i].ft, &q[i].sc.ft, &q[i].sc.sc);

	set<int> st;
	forn(i, n) st.insert(q[i].sc.sc);

	map<int, int> idx;
	int cc = 0;

	for(auto it = st.begin(); it != st.end(); it++) {
		idx[*it] = cc++;
	}

	forn(i, n) {
		int x = idx[q[i].sc.sc];
		a[x].insert(q[i].sc.ft);
	}

	forn(i, cc) {
		for(auto it = a[i].begin(); it != a[i].end(); it++)
			b[i].push_back(*it);
	}

	forn(i, cc) {
		f[i].resize(sz(a[i]));
	}

	forn(i, n) {
		if (q[i].ft == 1) {
			int x = idx[q[i].sc.sc];
			int t = q[i].sc.ft;
			int pos = lower_bound(all(b[x]), t) - b[x].begin();
			while (pos < sz(f[x])) {
				f[x][pos]++;
				pos |= (pos + 1);
			}
		} else if (q[i].ft == 2) {
			int x = idx[q[i].sc.sc];
			int t = q[i].sc.ft;
			int pos = lower_bound(all(b[x]), t) - b[x].begin();
			while (pos < sz(f[x])) {
				f[x][pos]--;
				pos |= (pos + 1);
			}
		} else {
			int x = idx[q[i].sc.sc];
			int t = q[i].sc.ft;
			int pos = lower_bound(all(b[x]), t) - b[x].begin();
			int ans = 0;
			while (pos >= 0) {
				ans += f[x][pos];
				pos = (pos & (pos + 1)) - 1;
			}
			printf("%d\n", ans);
		}
	}

    return 0;
}


//#define MYDEBUG
#define _CRT_SECURE_NO_WARNINGS
#define TASK "C-small-attempt0"
#pragma comment(linker, "/STACK:536870912")
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#include <cassert>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <random>

const int MOD = 1000000007;
const int INF = 1000000001;
const int MAXN = 100010;
const long double EPS = 1e-6;
const int HASH_POW = 29;
const long double PI = acos(-1.0);

using namespace std;

void my_return(int code)
{
#ifdef MYDEBUG
	cout << "\nTime = " << fixed << setprecision(3) << double(clock()) / CLOCKS_PER_SEC << endl;
#endif
	exit(code);
}

int n, a[1000010], t[1000010], x[1000010], tmp[1000010], ll[1000010];
int ord[1000010];
vector <int> G[1000010], F[1000010];

int main()
{
	cin.sync_with_stdio(0);
	cin.tie(0);
	mt19937 mt_rand(time(0));
#ifdef MYDEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	/*freopen(TASK".in", "rt", stdin);
	freopen(TASK".out", "wt", stdout);*/
	/*freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);*/
#endif

	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d %d", &a[i], &t[i], &x[i]);

	for (int i = 0; i < n; ++i)
		tmp[i] = t[i];
	sort(tmp, tmp + n);
	for (int i = 0; i < n; ++i)
	{
		int ll = -1, rr = n;
		while (ll + 1 < rr)
		{
			int mid = (ll + rr) / 2;
			if (tmp[mid] >= t[i])
				rr = mid;
			else
				ll = mid;
		}
		t[i] = rr;
	}

	for (int i = 0; i < n; ++i)
		tmp[i] = x[i];
	sort(tmp, tmp + n);
	for (int i = 0; i < n; ++i)
	{
		int ll = -1, rr = n;
		while (ll + 1 < rr)
		{
			int mid = (ll + rr) / 2;
			if (tmp[mid] >= x[i])
				rr = mid;
			else
				ll = mid;
		}
		x[i] = rr + 1;
	}

	for (int i = 0; i < n; ++i)
	{
		if (a[i] == 1)
			ord[t[i]] = x[i];
		else if (a[i] == 2)
			ord[t[i]] = -x[i];
	}
	for (int i = 0; i < n; ++i)
	{
		if (ord[i] > 0)
			G[ord[i]].push_back(i);
		else
			F[-ord[i]].push_back(i);
	}
	for (int i = 0; i < n; ++i)
	{
		if (a[i] != 3)
			continue;
		int ans = 0;
		int ll = -1, rr = G[x[i]].size();
		while (ll + 1 < rr)
		{
			int mid = (ll + rr) / 2;
			if (G[x[i]][mid] <= t[i])
				ll = mid;
			else
				rr = mid;
		}
		ans += rr;
		ll = -1, rr = F[x[i]].size();
		while (ll + 1 < rr)
		{
			int mid = (ll + rr) / 2;
			if (F[x[i]][mid] <= t[i])
				ll = mid;
			else
				rr = mid;
		}
		ans -= rr;
		printf("%d\n", ans);
	}

	my_return(0);
}