#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i> n; vector

a(n); VI b(n); REP(i,n) cin >> a[i].first; REP(i,n) a[i].second=i; REP(i,n) cin >> b[i]; sort(ALL(a)); map mp; int mx=0; int ans=0; do{ int sum=0; REP(i,n) sum+=max(0ll,a[i].first-b[i]); mp[sum]++; mx=max(mx,sum); }while(next_permutation(ALL(a))); cout << mp[mx] << endl; return 0; }