#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")

#define pb emplace_back
#define fi first
#define se second
#define FOR(a,b,i) for (int i=a;i!=b;a>b?i--:i++)
#define F0R(a,i) FOR(0,a,i)
#define sz(a) (int)(a).size()
#define ll long long 
#define endl '\n'
#define INF 1e9+5
#define LINF 1e18+5
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
int main(){
	fastio;
	int n,cur=0,inp; cin >> n;
	int arr[n];
	F0R(n,i) cin >> arr[i];
	F0R(n,i){
		cin >> inp;
		cur+=arr[i]*inp;
	}
	if (cur==0) cout << "Yes";
	else cout << "No";
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

struct uf {
  vector<int> d;
  uf(){}
  uf(int mx):d(mx,-1){}
  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x,y);
    d[x] += d[y]; d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y);}
  int size(int x) { return -d[root(x)];}
  int operator[](int x) { return root(x);}
  int operator()(int x) { return size(x);}
};

ll GCD(ll a, ll b){
  if(b == 0) return a;
  else return GCD(b,a%b);
}
ll LCM(ll a, ll b){
	return a/GCD(a,b)*b;
}

const int INF = 1e9 + 7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  ll ans = 1;
  ll syo = 0;
  rep(i,n){
    ans *= (a[i] - syo) + 1;
    ans %= INF;
    syo = a[i];
  }
  cout << ans << endl;
	return 0;
}

// cout << fixed << setprecision(15) <<  << endl;
//lower_bound(a+l,a+r,x) -a  
//はa[l]からa[r-1]までのなかで初めてx以上となるようなインデックスを返す