from itertools import permutations as p from math import factorial as fact n = int(input()) a, b = [tuple(map(int, input().split(" "))) for _ in range(2)] count = 0 for a_i in p(a, n): for b_i in p(b, n): count += (sum(a_j > b_j for a_j, b_j in zip(a_i, b_i)) / n > 0.5) print(count / fact(n)**2)