#include #include #include using namespace std; #define RREP(i,s,e) for (i = e-1; i >= s; i--) #define rrep(i,n) RREP(i,0,n) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 double dfs(vector& a, vector& b, int cnt) { int i, j, ret = 0; if (a.empty()) return cnt > 0; rep (i,a.size()) rep (j,b.size()) { auto x = a; auto y = b; int c = cnt; x.erase(x.begin()+i); y.erase(y.begin()+j); c += (a[i] > b[j]) - (a[i] < b[j]); ret += dfs(x,y,c); } return ret; } int main() { int n, i, total = 1; double ans; vector a,b; cin >> n; a.resize(n); b.resize(n); rep (i,n) cin >> a[i]; rep (i,n) cin >> b[i]; rep (i,n) total *= i+1; total *= total; ans = dfs(a,b,0) / total; cout << ans << endl; return 0; }