#include <bits/stdc++.h>
using namespace std;
using ll = long long;//大きなint型
using P = pair<int,int>;//pair型の型エイリアス
#define rep(i,n) for (int i = 0; i < (n); ++i)//iをnまですすめる。

int main(){
    int n;
    int sum = 0;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n){
        cin >> a.at(i);
    }
    rep(i,n){
        cin >> b.at(i);
    }
    rep(i,n){
        sum += a.at(i)*b.at(i);
    }
    if(sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000009
#define pb push_back
#define mp make_pair
#define endl '\n'
#define N 100005
using namespace std;
int a[N],p[N];
//https://www.geeksforgeeks.org/program-decimal-octal-conversion/
int decToOctal(int n)
{
     int f= 1;
    // array to store octal number
    int octalNum[50];
 
    // counter for octal number array
    int i = 0;
    while (n != 0) {
 
        // storing remainder in octal array
        octalNum[i] = n % 8;
        n = n / 8;
        i++;
    }
 
    // printing octal number array in reverse order
    for (int j = i - 1; j >= 0; j--)
	{
		if(octalNum[j] == 7)
			f = 0;
	}
	return f;
}
int dig (int n)
{
	int f=1;
	while(n){
		int d = n%10;
		if(d==7) f = 0 ;
		n/=10;
	}
	return f;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	int f1=0,f2=0;
    	f2 = dig(i);
    	f1 = decToOctal(i);
    	if(f1 && f2){
    		//cout<<i<<' ';
    		p[i]+=p[i-1]+1;
    	}
    	else{
    		p[i] = p[i-1];
    	}
    }
   // cout<<endl;
    cout<<p[n]<<endl;
 }
