import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Deque; import java.util.Iterator; import java.util.List; public class Main_yukicoder133 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { b[i] = sc.nextInt(); } int win = 0; int cnt = 0; Permutation np = new Permutation(n); for (List perm : np) { if (perm == null) { break; } // System.out.println(perm); int awin = 0; for (int i = 0; i < n; i++) { if (a[i] > b[perm.get(i)]) { awin++; } else if (a[i] < b[perm.get(i)]) { awin--; } } if (awin > 0) { win++; } cnt++; } pr.printf("%.3f\n", (double)win / cnt); pr.close(); sc.close(); } private static class Permutation implements Iterable>{ int n; boolean[] used; List perm; Deque ist; PermutationIterator it; Permutation(int n) { this.n = n; used = new boolean[n]; perm = new ArrayList(); ist = new ArrayDeque(); ist.add(-1); it = new PermutationIterator(this); } List next() { out: while (!ist.isEmpty()) { int k = ist.pop(); if (k != -1) { // ループ途中での戻り used[k] = false; perm.remove(perm.size() - 1); } else { // 最初から int pos = perm.size(); if (pos == n) { // perm に対する操作 ========================= return perm; // perm に対する操作 ========================= } } for (int i = k + 1; i < n; i++) { if (!used[i]) { ist.push(i); used[i] = true; perm.add(i); ist.push(-1); continue out; } } } return null; } @Override public Iterator> iterator() { return it; } private static class PermutationIterator implements Iterator> { Permutation p; PermutationIterator(Permutation p) { this.p = p; } @Override public boolean hasNext() { return !p.ist.isEmpty(); } @Override public List next() { return p.next(); } } } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }