import sys
from itertools import permutations
from math import factorial

def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    tot = factorial(N) ** 2
    win = 0

    for pA in permutations(A):
        for pB in permutations(B):
            cnt = 0
            for a, b in zip(pA, pB):
                if a > b:
                    cnt += 1

            if cnt > N - cnt:
                win += 1

    ans = win / tot
    print(ans)

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()