#include using namespace std; #define rep(i,n) for (long long i = 0; i < (n); ++i) using ll = long long; using P = pair; using vec = vector; using vecp = vector

; using mat = vector; using matp = vector; const ll MOD = 1777777777; const ll INF = 1e18; #define all(v) v.begin(), v.end() //mat G(N); void no_cost_graphmake(ll E,mat &G){ rep(i,E){ ll a,b; cin >> a >> b; G.at(a-1).push_back(b-1); G.at(b-1).push_back(a-1);//有向なら消す } } //vec d(N); void no_cost_dijkstra(ll s,vec &d, mat &G,ll V){ queue que; rep(i,V) d.at(i)=INF; d.at(s)=0; que.push(s); while(!que.empty()){ ll p=que.front(); que.pop(); rep(i,G.at(p).size()){ ll e=G.at(p).at(i); if(d.at(e)>d.at(p)+1){ d.at(e)=d.at(p)+1; que.push(e); } } } } int main(){ ll N; cin >> N; vec A(N),B(N); rep(i,N) cin >> A.at(i); rep(i,N) cin >> B.at(i); ll ans=0,t=-1; sort(all(A)); do{ ll k=0; rep(i,N){ k+=max(A.at(i)-B.at(i),(ll)0); } if(t==k){ ans++; }else if(t