#include <bits/stdc++.h>

long double EPS = 1e-12;

using namespace std;

vector<complex<long double>> rotate(vector<complex<long double>> points, const complex<long double>& rot) {
  for (auto& p : points) {
    p *= rot;
  }
  return points;
}

bool equals(vector<complex<long double>> points1, vector<complex<long double>> points2) {
  if (points1.size() != points2.size()) return false;
  
  int n = points1.size();
  
  sort(points1.begin(), points1.end(), [](const complex<long double>& c1, const complex<long double>& c2) {
    if (abs(c1.real() - c2.real()) < EPS) return c1.imag() < c2.imag();
    return c1.real() < c2.real();
  });
  
  sort(points2.begin(), points2.end(), [](const complex<long double>& c1, const complex<long double>& c2) {
    if (abs(c1.real() - c2.real()) < EPS) return c1.imag() < c2.imag();
    return c1.real() < c2.real();
  });
  
  for (int i = 0; i < n; i++) {
    if (abs(points1[i] - points2[i]) >= EPS) return false;
  }
  return true;
}

int main() {
  int N;
  cin >> N;
  
  vector<complex<long double>> S(N), T(N);
  
  for (int i = 0; i < N; i++) {
    double x, y;
    cin >> x >> y;
    S[i] = x + y * 1i;
  }
  
  for (int i = 0; i < N; i++) {
    double x, y;
    cin >> x >> y;
    T[i] = x + y * 1i;
  }
  
  complex<long double> gS = 0, gT = 0;
  
  for (int i = 0; i < N; i++) {
    gS += S[i];
    gT += T[i];
  }
  
  gS /= N;
  gT /= N;
  
  for (int i = 0; i < N; i++) {
    S[i] -= gS;
    T[i] -= gT;
  }
  
  for (int i = 0; i < N; i++) {
    if (S[i] == complex<long double>(0)) {
      S.erase(S.begin() + i);
      break;
    }
  }
  
  for (int i = 0; i < N; i++) {
    if (T[i] == complex<long double>(0)) {
      T.erase(T.begin() + i);
      break;
    }
  }
  
  bool able = false;
  
  if (S.size() == T.size()) {
    for (int i = 0; i < N; i++) {
      able |= equals(S, rotate(T, S[0] * abs(T[i]) / (T[i] * abs(S[0]))));
    }
  }
  
  if (able) puts("Yes");
  else puts("No");
  
  return 0;
}
#include<bits/stdc++.h>
#define ln puts("")
#define sp printf(" ")
using namespace std;
typedef long long ll;

inline ll read() {
	ll sum = 0, ff = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') {
		if(ch == '-')
			ff = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
		sum = sum * 10 + ch - '0', ch = getchar();
	return sum * ff;
}

void write(ll x) {
	if(x < 0)
		putchar('-'), x = -x;
	if(x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
}

const int N = 1e5 + 7;
int n, a[N], b[N], c[N], mp1[N], mp2[N];
ll ans;

int main() {
//	freopen("", "r", stdin);
//	freopen("", "w", stdout);
	n = read();
	for(int i = 1; i <= n; i++)
		a[i] = read(), mp1[a[i]]++;
	for(int i = 1; i <= n; i++)
		b[i] = read();
	for(int i = 1; i <= n; i++)
		c[i] = read(), mp2[c[i]]++;
	for(int i = 1; i <= n; i++)
		ans += (ll)mp1[b[i]] * mp2[i];
	write(ans);
	return 0;
}
