import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.math; import std.numeric; import std.range; import std.stdio; import std.string; import std.typecons; void log(A...)(A arg) { stderr.writeln(arg); } int size(T)(in T s) { return cast(int)s.length; } void main() { int N = readln.chomp.to!int; auto A = readln.chomp.split(" ").map!(to!int).array; auto B = readln.chomp.split(" ").map!(to!int).array; int f(int s) { int next(int i) { return (i + 1) % N; } BinaryHeap!(Array!(Tuple!(int, int)), "a > b") h; foreach (i; 0 .. N) { h.insert(tuple(A[i], i)); } auto c = new int[N]; for (int i = s, flag = true; flag || i != s; i = next(i), flag = false) { auto x = h.front; h.removeFront; c[ x[1] ]++; h.insert(tuple(x[0] + B[i] / 2, x[1])); } return reduce!max(0, c); } int ans = int.max; for (int i = 0; i < N; i++) { ans = min(ans, f(i)); } writeln(ans); }