import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.PriorityQueue; public class Main_yukicoder9 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); List a = new ArrayList(); List b = new ArrayList(); for (int i = 0; i < n; i++) { a.add(sc.nextInt()); } for (int i = 0; i < n; i++) { b.add(sc.nextInt()); } int min = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { PriorityQueue pq = new PriorityQueue(); for (int j = 0; j < n; j++) { pq.add(new Monster(a.get(j))); } int max = 0; for (int j = 0; j < n; j++) { Monster m = pq.remove(); m.lv += b.get((i + j) % n) / 2; m.cnt++; max = Math.max(max, m.cnt); pq.add(m); } min = Math.min(min, max); } pr.println(min); pr.close(); sc.close(); } private static class Monster implements Comparable { int lv; int cnt; Monster(int lv) { this.lv = lv; cnt = 0; } @Override public int compareTo(Monster o) { if (this.lv != o.lv) { return Integer.compare(this.lv, o.lv); } return Integer.compare(this.cnt, o.cnt); } } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }