#include #include #include using namespace std; int main(){ int n;cin>>n; vector A(n),B(n); for(int i = 0; n > i; i++){ cin>>A[i]; } for(int i = 0; n > i; i++){ cin>>B[i]; } sort(A.begin(),A.end()); int ans = 0; int t = 0; do{ int tmp = 0; for(int i = 0; n > i; i++){ if(A[i] > B[i]){ tmp += A[i]-B[i]; } } if(tmp > ans){ ans = tmp; t = 1; }else if(tmp == ans){ t++; } }while(next_permutation(A.begin(),A.end())); cout << t << endl; }