import bisect import heapq import itertools import math import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce from operator import itemgetter import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 N = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) B = list(map(int, sys.stdin.readline().split())) A = np.array(A) B = np.array(B) cnt = 0 s = 0 for a, b in itertools.product(itertools.permutations(range(N)), repeat=2): a = A[np.array(a)] b = B[np.array(b)] cnt += (a > b).sum() > N / 2 s += 1 print(cnt / s)