import sys #sys.setrecursionlimit(n) import heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy from decimal import * n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) aa = list(itertools.permutations(a)) bb = list(itertools.permutations(b)) win_count = 0 pt_count = 0 for ta in aa: for tb in bb: pt_count += 1 win = 0 for i in range(n): if ta[i] > tb[i]: win += 1 if win > (n / 2): win_count += 1 break print(win_count / pt_count)