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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    int N; cin >> N;
    vector<int> a(N),b(N);
    rep(i,N) cin >> a[i];
    rep(i,N) cin >> b[i];
    map<ll,ll> mp;
    vector<int> c(N);
    iota(c.begin(), c.end(), 0);
    do{
        ll now = 0;
        rep(i,N){
            now = now + max(a[c[i]] - b[i], 0);
        }
        mp[now]++;
    }while(next_permutation(c.begin(), c.end()));
    ll ans = 0;
    for(auto u : mp){
        ans = max(ans, u.first);
    }
    cout << mp[ans] << endl;
}