import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int[] AS = new int[N]; final int[] BS = new int[N]; for(int i = 0; i < N; i++){ AS[i] = sc.nextInt(); } for(int i = 0; i < N; i++){ BS[i] = sc.nextInt(); } ArrayList A_random = new ArrayList(); ArrayList B_random = new ArrayList(); for(int i = 0; i < N; i++){ A_random.add(i); B_random.add(i); } double answer = Double.NaN; for(int i = 0; i < 1000000; i++){ Collections.shuffle(A_random); Collections.shuffle(B_random); int count = 0; for(int j = 0; j < N; j++){ count += (AS[A_random.get(j)] > BS[B_random.get(j)]) ? 1 : 0; } double prob = (count > N / 2) ? 1 : 0; if(Double.isNaN(answer)){ answer = prob; }else{ answer += (prob / i); answer *= i; answer /= (i + 1); } //System.out.printf("%d : %.08f\n", i, answer); } System.out.printf("%.08f\n", answer); } }