import std.algorithm, std.array, std.container, std.range; import std.string, std.conv; import std.math, std.bigint, std.bitmanip, std.random; import std.stdio, std.typecons; const auto repeat = 10 ^^ 6; void main() { auto n = readln.chomp.to!int; auto ai = readln.split.map!(to!int).array; auto bi = readln.split.map!(to!int).array; auto r = 0; foreach (_; 0..repeat) { ai.randomShuffle; bi.randomShuffle; if (ai.zip(bi).count!("a[0] > a[1]") > n / 2) r += 1; } writefln("%f", r.to!real / repeat); }