#include using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair; using pll = pair; #define ull unsigned long long #define ld long double #define vi vector #define vll vector #define vc vector #define vs vector #define vpii vector #define vpll vector #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++) #define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++) #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define RSORT(x) sort(rall(x)); #define pb push_back #define mp make_pair #define INF (1e9) #define PI (acos(-1)) #define EPS (1e-7) ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; } ull lcm(ull a, ull b) { return a / gcd(a, b) * b; } const int n_max = 4; vi a(n_max), b(n_max); vi an(n_max), bn(n_max); vector au(n_max), bu(n_max); int cnt_a = 0, cnt = 0; void perm(int pos, int n) { if (pos == n*2) { int at = 0, bt = 0; rep(i, n) { if (an[i] > bn[i]) ++at; else ++bt; } if (at > bt) ++cnt_a; ++cnt; return; } if (pos < n) { rep(i, n) { if (au[i]) continue; au[i] = true; an[pos] = a[i]; perm(pos+1, n); au[i] = false; } } else if (pos >= n) { rep(i, n) { if (bu[i]) continue; bu[i] = true; bn[pos-n] = b[i]; perm(pos+1, n); bu[i] = false; } } } int main(){ int n; cin >> n; rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; perm(0, n); cout << (double)cnt_a/cnt << endl; return 0; }