#include #include #include #include #define repi(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,a) repi(i,0,a) #define all(a) (a).begin(), (a).end() int N; int A[4], B[4]; int cnt, den; int main() { scanf( "%d", &N ); rep( i, N ) scanf( "%d", A+i ); rep( i, N ) scanf( "%d", B+i ); std::vector as(N), bs(N); std::iota( all(as), 0 ); std::iota( all(bs), 0 ); do { do { int a = 0, b = 0; rep( i, N ) { if( A[as[i]] > B[bs[i]] ) ++a; else ++b; } if( a > b ) ++cnt; ++den; } while( std::next_permutation( all(bs) ) ); } while( std::next_permutation( all(as) ) ); printf( "%.6f\n", (double)cnt/den ); return 0; }