#include<bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    vector<double> a(N),b(N),c(N),d(N);
    for(int _=0; _<2; _++){
        for(int i=0; i<N; i++) cin >> a[i] >> b[i];
        int x = 0, y = 0;
        for(int i=0; i<N; i++){
            x += a[i];
            y += b[i];
            a[i] *= N;
            b[i] *= N;
        }
        for(int i=0; i<N; i++){
            a[i] -= x;
            b[i] -= y;
        }
        swap(a,c);
        swap(b,d);
    }
    for(int i=0; i<N; i++){
        if(a[i]!=0 || b[i]!=0){
            swap(a[i],a[0]);
            swap(b[i],b[0]);
        }
    }
    string ans = "No";
    const double eps = 1e-6;
    for(int i=0; i<N; i++){
        double angle = atan2(d[i],c[i])-atan2(b[0],a[0]);
        bool flag = true;
        for(int j=0; j<N; j++){
            double A = a[j]*cos(angle)-b[j]*sin(angle);
            double B = a[j]*sin(angle)+b[j]*cos(angle);
            bool flag2 = false;
            for(int k=0; k<N; k++){
                if(std::abs(A-c[k])<=eps && std::abs(B-d[k])<=eps) flag2 = true;
            }
            flag &= flag2;
        }
        if(flag) ans = "Yes";
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;
 
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector <string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pi;

//#define int ll
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
//#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238
// #define MOD 1000000007
#define rep(i,n) for(int i=0; i<n; i++) 
#define rep1(i,n) for(int i=1; i<=n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rrep1(i,n) for(int i=n; i>=1; i--)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"


const ll M=1e9+7;
long long mod(long long x){
    return ((x%M + M)%M);
}
long long add(long long a, long long b){ //(a+b)%M
    return mod(mod(a)+mod(b));
}
long long mul(long long a, long long b){ //(a*b)%M
    return mod(mod(a)*mod(b));
}
long long modPow(int x, int y){ //(x^y)%M
    if(y==0) return 1LL;
    if(y==1) return mod(x);
    long long res=1;
    while(y){
        if(y%2==1)
            res=mul(res,x);
        x=mul(x,x);
        y/=2;
    }
    return res;
}
const int N=2e5+2;
int fact[N];

void precalc(){
    fact[0]=1;
    for(int i=1;i<N;i++){
        fact[i]=mul(fact[i-1],i);
    }
}
ll inv(ll x){
    return modPow(x,M-2);
}
ll divide(ll a, ll b){
    return mul(a,inv(b));
}
ll nCr(ll n, ll r){
    return divide(fact[n],mul(fact[r],fact[n-r]));
}

void io() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

// number of partition sticks.. from 0 to n-1
// loop from 1 to n for first partition
// recurse on the left part for partitions-1; until no patition

void solve() {
    int n; cin>>n;
    vl a(n);
    rep(i,n) cin>>a[i];
    
if(n==1) {
    cout<<a[0]<<"\n"; return;
}

ll range = (1<<(n-1))-1;
ll ans = INT_MAX;
for(ll j=0; j<range; j++) {
    // convert to binary digits and do partitions alongwith
    vector<ll> b;
    ll total = 0;
    for(ll i=0; i<n; i++) {
        total |= a[i];
        if(j&(1<<i)) {
            b.push_back(total);
            total = 0;
        }
    }
    if(total) b.push_back(total);
    ll cal = 0;
    for(auto el: b) cal ^= el;
    
    ans = min(ans, cal);
    
}

cout<<ans;

    return;
}
int32_t main() {
    io();
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}