# import sys # readline = sys.stdin.buffer.readline from collections import deque from copy import copy,deepcopy from itertools import permutations,combinations def myinput(): return map(int,input().split()) def mycol(data,col): return [ row[col] for row in data ] n = int(input()) a = list(myinput()) b = list(myinput()) pa = list(permutations(a)) pb = list(permutations(b)) # print(pa) # print(pb) count_win_a = 0 count_win_b = 0 count_match = 0 for pattern_a in pa: for pattern_b in pb: count_match += 1 count_a = 0 count_b = 0 for i in range(n): card_a = pattern_a[i] card_b = pattern_b[i] if card_a > card_b: count_a += 1 else: count_b += 1 if count_a > count_b: count_win_a += 1 elif count_a==count_b: pass else: count_win_b += 1 # print(count_win_a,count_match) ans = count_win_a/count_match print(ans)