#include <bits/stdc++.h>
 
using namespace std;
int main()
{
  int n;
  
  scanf("%d",&n);
  int a[n];
  int i,sum=0;
  int num;
  int min=32000;
  for(i=0;i<n;++i)
  {
    scanf("%ld%ld",&a[i],&b[i]);
    sum+=a[i];
  }
  
  float avg=(float)sum/n;
  
  sort(a,a+n);
  for(i=0;i<n;++i)
  {
     if(min>(avg-a[i]))
     {
       min=avg-a[i];
       num=i;
     }
  }
  
    printf("%d",num);
  
}