from math import factorial import itertools def init(): n = int(input()) A = map(int, input().split()) A = list(itertools.permutations(A)) B = map(int, input().split()) B = list(itertools.permutations(B)) return A, B def fullsearch(): A, B = init() win = 0 for a, b in itertools.product(A, B): a_crt = 0 b_crt = 0 for _a, _b in zip(a, b): if _b < _a: a_crt += 1 else: b_crt += 1 if b_crt < a_crt: win += 1 ans = win / len(A)**2 return ans if __name__ == "__main__": ans = fullsearch() print(ans)