#include using namespace std; #define ll long long #define REP(i,x) for(int i=0;i<(int)(x);i++) #define REPS(i,x) for(int i=1;i<=(int)(x);i++) #define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--) #define RREPS(i,x) for(int i=((int)(x));i>0;i--) const ll mod = 1e9 + 7; typedef pair PI; typedef pair PL; typedef vector vip; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; int fact(int k){ return k==0 ? 1 : k * fact(k-1); } int main (){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vi a(n); vi b(n); REP(i,n) { cin >> a[i]; } REP(i,n) { cin >> b[i]; } int perm = fact(n); float won = 0; for(int i = 0; i < perm; i++){//かつ回数数える REP(j,perm){ int count = 0; int cont = 0; REP(d,n){ if(a[d] - b[d] > 0){ count++; } if(a[d] - b[d] < 0){ cont++; } } if(count > cont) won++; next_permutation(b.begin(), b.end()); } next_permutation(a.begin(), a.end()); } perm *= perm; float ans = won / perm; cout << ans << endl; return 0; }