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

typedef long long ll;
const ll MAXN = 3e5;
ll n, a[MAXN];
ll solve() {
    sort(a, a+n);
    vector<ll> grps;
    ll last = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] != a[last]) {
            grps.push_back(i-last);
            last = i;
        }
    }
    grps.push_back(n-last);
    ll tot = accumulate(grps.begin(), grps.end(), 0LL);
    for (ll i: grps) {
        ans += i * (tot-i);
        tot -= i;
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    cout << solve() << '\n';
    
    return 0;
}
#include<bits/stdc++.h>
#define ll long long int
#define rep(i,a,b) for (int i = a; i <b; i++)
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{ll n;cin>>n;ll a[n],b[n];
	ll sum=0,i;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
    	for( i=0;i<n;i++)
	{
		cin>>b[i];
	}
	for(i=0;i<n;i++)
	{
		sum+=a[i]*b[i];
	}
	cout<<((sum==0)?"Yes":"No");
}
