from collections import defaultdict, deque from bisect import bisect_right, bisect_left from random import randint from itertools import permutations # from more_itertools import distinct_permutations from heapq import heappush, heappop import sys import math import copy # from sortedcontainers import SortedList sys.setrecursionlimit(100000000) n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 cnt2 = 0 for p1 in permutations(a): for p2 in permutations(b): cnt2 += 1 cnt = 0 for i in range(n): if p1[i] > p2[i]: cnt += 1 if cnt > (n - cnt): ans += 1 ans /= cnt2 print(ans)