#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 int main(){ int N; cin>>N; vector a(N),b(N); rep(i,N)cin>>a[i]; rep(i,N)cin>>b[i]; vector t(N); int M = 0; rep(i,N)t[i] = i; do{ int sum = 0; rep(i,N){ sum += max(0,a[t[i]]-b[i]); } M = max(M,sum); } while(next_permutation(t.begin(),t.end())); int ans = 0; rep(i,N)t[i] = i; do{ int sum = 0; rep(i,N){ sum += max(0,a[t[i]]-b[i]); } if(sum==M)ans++; } while(next_permutation(t.begin(),t.end())); cout<