#from __future__ import annotations from typing import List,Union import sys input = sys.stdin.readline # from collections import defaultdict,deque from itertools import permutations,combinations # from bisect import bisect_left,bisect_right # import heapq # sys.setrecursionlimit(10**5) def main(): N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) total = 0 wins = 0 for a in permutations(A): for b in permutations(B): total += 1 win = 0 lose = 0 for x,y in zip(a,b): if x > y: win += 1 if x < y: lose += 1 if win > lose: wins += 1 print(wins/total) if __name__ == '__main__': main()