#include<bits/stdc++.h>
#define Woody
#define int long long
#define rep(n) for(int i=0;i<n;i++)
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#ifdef Woody
#define quick ios::sync_with_stdio(0);cin.tie(0);
#else
#define quick
#endif
#define INF INT64_MAX
#define PI 3.14159265
using namespace std;
const double eps=1e-3;
typedef pair<double,double> p;
bool ok(int n,vector<p> v1,vector<p> v2){
//	cout<<"OK\n";

	sort(v2.begin(),v2.end());
/*	rep(n){
		printf("%.5lf %.5lf\n",v1[i].F,v1[i].S);
	}//cout<<"\n";
	rep(n){
		printf("%.5lf %.5lf\n",v2[i].F,v2[i].S);
	}cout<<"\n";*/
	double disx=v1[0].F-v2[0].F;
	double disy=v1[0].S-v2[0].S;
	for(int i=1;i<n;i++){
		double dx=v1[i].F-v2[i].F;
		double dy=v1[i].S-v2[i].S;
		if(abs(disx-dx)>eps||abs(disy-dy)>eps) return false;
	}


	return true;
}
bool solve(){
	int n;
	cin>>n;
	vector<p> v1(n);
	vector<p> v2(n);
	rep(n){
		cin>>v2[i].F>>v2[i].S;
	}
	rep(n){
		cin>>v1[i].F>>v1[i].S;
	}
	sort(v1.begin(),v1.end());
	vector<p> v3(n);
	for(double d=0;d<=360;d+=0.0005){
		double s=sin(d*PI/180.0);
		double c=cos(d*PI/180.0);
		rep(n){
			double x=v2[i].F;
			double y=v2[i].S;
			v3[i].F=x*c+y*(-1)*s;
			v3[i].S=x*s+y*c;
		}
		if(ok(n,v1,v3)) return true;
	}
	return false;
}
signed main(){
	quick
	bool f=solve();
	if(f) cout<<"Yes\n";
	else cout<<"No\n";

}
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)

template < typename Iterator >
void dump(Iterator fst, Iterator lst, string const dm = " ")
{ auto it=fst; for ( it!=lst && cout<<to_string(*it++); it!=lst; ) cout << dm << to_string(*it++);
  cout << endl; }

template < typename T >
void dump( T const & v, string const delim = " ")
{ dump(begin(v), end(v), delim); }

ll N;
typedef pair<ll, ll> pll;
vector<ll> A, B;
void solve(void);

int main()
{
  cin >> N;
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
  }
  solve();
}

void solve(void)
{
  ll sa = 0;
  vector<ll> aa;
  REP(i, N) {
    sa += A[i];
    aa.push_back(2*A[i]+B[i]);
  }

  ll ans = 0;
  ll d = sa;
  //cout << sa << endl;
  sort(aa.begin(), aa.end(), [](auto const& l, auto const& r){ return l > r; });
  for (auto a : aa) {
    //cout << "a = " << a << endl;
    if (d<0) break;
    d -= a;
    ans++;
  }
  cout << ans << endl;
}
