#include #define For(i, a, b) for(int i = a; i < b; i++) #define rep(i, n) For(i, 0, n) #define rFor(i, a, b) for(int i = a; i >= b; i--) #define ALL(v) (v).begin(), (v).end() #define rALL(v) (v).rbegin(), (v).rend() using namespace std; using lint = long long; using ld = long double; int INF = 2000000000; lint LINF = 1000000000000000000; int main() { int n; cin >> n; vector a(n); rep(i, n) { cin >> a[i]; } vector b(n); rep(i, n) { cin >> b[i]; } vector x(n); rep(i, n) { x[i] = i; } ld all = 0, win = 0; do { vector y(n); rep(i, n) { y[i] = i; } do { all++; int ca = 0, cb = 0; rep(i, n) { if (a[x[i]] > b[y[i]]) { ca++; } else if (a[x[i]] < b[y[i]]) { cb++; } } if (ca > cb) { win++; } } while (next_permutation(ALL(y))); } while (next_permutation(ALL(x))); cout << fixed << setprecision(10) << win / all << endl; }