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