#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;

using C = complex<double>;
const double gs = 0.000001;

int main(){
    int n;
    cin >> n;
    vector<double> lx(n), ly(n), rx(n), ry(n);
    rep(i,n) cin >> lx[i] >> ly[i];
    rep(i,n) cin >> rx[i] >> ry[i];
    double ljx, ljy, rjx, rjy;
    ljx = ljy = rjx = rjy = 0;
    rep(i,n){
        ljx += lx[i];
        ljy += ly[i];
        rjx += rx[i];
        rjy += ry[i];
    }
    ljx /= n; ljy /= n; rjx /= n; rjy /= n;
    rep(i,n){
        lx[i] -= ljx;
        ly[i] -= ljy;
        rx[i] -= rjx;
        ry[i] -= rjy;
    }
    string ans = "No";
    rep(i,n){
        rep(j,n){
            double llen = sqrt(lx[i]*lx[i] + ly[i]*ly[i]);
            double rlen = sqrt(rx[j]*rx[j] + ry[j]*ry[j]);
            if(abs(rlen-llen) >= gs) continue;
            double lshi = atan2(ly[i], lx[i]);
            double rshi = atan2(ry[j], rx[j]);
            double shi = lshi - rshi;
            bool allMitukata = true;
            rep(j2, n){
                C tani(cos(shi), sin(shi));
                C r(rx[j2], ry[j2]);
                r = r*tani;
                double rx2 = r.real(); // kaitenn
                double ry2 = r.imag();
                bool mitukata = false;
                rep(i2, n){
                    if(abs(lx[i2]-rx2)>=gs || abs(ly[i2]-ry2)>=gs) continue;
                    mitukata = true;
                }
                if(!mitukata) allMitukata = false;
            }
            if(allMitukata) ans = "Yes";
        }
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long int ll;
#define int ll
using vi = vector<int>;

signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(false);

   int n;
   cin >> n;
   bitset<100001> dp;
   dp[0]=1;
   int tot = 0;
   rep(i,n){
       int t;
       cin>>t;
       tot += t;
       dp |= dp<<t;
   }
   int ans = tot;
   rep(i,tot+1)if(dp[i])ans = min(ans,max(tot-i,i));

   cout << ans <<"\n";
   return 0;
}