#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int (i) = 0; i < (n); i++) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; //const ll mod = 1e9 + 7; const ll mod = 998244353; const int inf = 123456; const ll mx = 1e9; int main(){ int n; cin >> n; vector a(n) , b(n) , ind(n); rep(i,n)cin >> a[i]; rep(i,n)cin >> b[i]; rep(i,n)ind[i] = i; sort(a.begin() , a.end()); sort(b.begin() , b.end()); map cnt; do{ ll cost = 0; rep(k,n){ cost += max(0 , a[ind[k]] - b[k]); } cnt[cost]++; }while(next_permutation(ind.begin() , ind.end())); ll mx_cost = -1; int ans = 0; for(auto i : cnt){ if(mx_cost <= i.first){ mx_cost = i.first; ans = i.second; } } cout << ans << endl; return 0; }