import sys from itertools import permutations sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) win = 0 total = 0 for pattern_A in permutations(A): for pattern_B in permutations(B): total += 1 cnt = 0 for a, b in zip(pattern_A, pattern_B): if a > b: cnt += 1 if n - cnt < cnt: win += 1 print(win / total) if __name__ == '__main__': resolve()