def run(): N = int(input()) A_list = list(map(int, input().split())) B_list = list(map(int, input().split())) array_A_list = array(A_list, N) array_B_list = array(B_list, N) #print(array_A_list) num_win = 0 total = 0 for a_list in array_A_list: for b_list in array_B_list: sub_total = 0 total += 1 #print(a_list, b_list) for a, b in zip(a_list, b_list): if a > b: sub_total += 1 if sub_total > N//2: num_win += 1 print(num_win/total) #print(num_win, total) def add(pre_list, n_list): new_list = [] for pre in pre_list: for n in n_list: if (n in pre) == False: new_list.append(pre+[n]) return new_list def array(n_list, N): res_list = [[n] for n in n_list] for n in range(N-1): res_list = add(res_list, n_list) return res_list if __name__ == '__main__': run()