import math from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) # A はそのまま # B の順番を変える(N!通り) cnt = 0 for pat in permutations(B): win = 0 lose = 0 for i in range(N): # A[i] vs pat[i] if A[i] > pat[i]: win += 1 else: lose += 1 if win > lose: cnt += 1 ans = cnt/math.factorial(N) print(ans)