import itertools as it import math n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for pa in it.permutations(a, n): for pb in it.permutations(b, n): cnt = 0 for i in range(n): if pa[i] > pb[i]: cnt += 1 if cnt > n // 2: ans += 1 ans /= (math.factorial(n) ** 2) print(ans)