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 for ta in aa: for tb in bb: if ta[0] > tb[0] and ta[1] > tb[1]: win_count += 1 print(win_count / (len(aa) * 2))