import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static int N; static int M; static int MAX = -1; //static int tic[][]; static int A[]; static int B[]; //static int max; static long DP[]; static int ST[][]; //static int p[]; //static ArrayList> al; static TreeMap> hm; //static ArrayList al; //static int a[][]; //static char[][] ch; //static ArrayList> al; //static String a[]; //static String str; public static void main(String[] args) { //StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); N = sc.nextInt(); A = new int[N]; 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(); } double ans = 0; double num = 0; switch (N) { case 1: num = 1; break; case 2: num = 2; break; case 3: num = 6; break; case 4: num = 24; break; } double win = 0; int c = 0; for (int i=0; i < num; i++) { int in = A[0]; A[0] = A[c]; A[c] = in; c = (c+1 == N? c=1:c+1); int n = 0; for (int t =0; t < N; t++) { if (A[t] > B[t]) { n++; } } if (n > N/2) { win++; } } ans = win / num; System.out.println(ans); } }