#include using namespace std; template using vp = vector>; template using pque = priority_queue; template using lpque = priority_queue,greater>; using ll = long long; using pint = pair; using pll = pair; using pil = pair; using pli = pair; using vint = vector; using vll = vector; using qint = queue; using pqint = pque; using qll = queue; using pqll = pque; #define PI 3.141592653589793 #define INTINF ((1<<30)-1) #define LLINF ((1LL<<62)-1) #define MPRIME 1000000007 #define MPRIME9 998244353 #define MMPRIME ((1ll<<61)-1) #define len length() #define pushb push_back #define fi first #define se second const char newl = '\n'; #define all(name) name.begin(),name.end() #define rall(name) name.rbegin(),name.rend() #define gsort(vbeg,vend) sort(vbeg,vend,greater<>()) template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline void init(T& v) { for(auto &a: v) cin>>a; } template inline void init(vector>& v) { for(auto &a: v) cin>>a.first>>a.second; } template inline void init(T& v, N n) { v.resize(n); for(auto &a: v) cin>>a; } template inline void init(vector>& v, N n) { v.resize(n); for(auto &a: v) cin>>a.first>>a.second; } template inline void out(T a) { cout< inline void out(T a, U... alist) { cout<(alist)...); } template void resiz(N n) { //empty } template void resiz(N n, T&& hd, U&&... tl) { hd.resize(n); resiz(n,forward(tl)...); } ll binpow(ll a, ll ex, ll p) { ll result=1; while(ex>0) { if(ex&1) result=result*a%p; ex>>=1; a=a*a%p; } return result; } ll factorial(int x, ll p=(1LL<<62)-1) { ll res = 1; for(int i=2; i<=x; i++) res = res * i % p; return res; } int N, ans=-1, n=0; vint A,B; void input() { cin>>N; init(A,N); init(B,N); } void solve() { sort(all(A)); do { int tmp=0; for(int i=0; iB[i]) tmp += A[i]-B[i]; } chmax(ans,tmp); }while(next_permutation(all(A))); do { int tmp=0; for(int i=0; iB[i]) tmp += A[i]-B[i]; } if(ans==tmp) n++; }while(next_permutation(all(A))); int z=1; for(int i=1; i