from itertools import permutations N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) result = [sum(1 if _a>_b else -1 if _a<_b else 0 for _a, _b in zip(ap, b)) > 0 for ap in permutations(a)] print(sum(result) / len(result))