import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); for (int i = 1; i < n; i++) { a[i] += a[i - 1]; } label: for (int x = 1; x <= a[n - 1]; x++) { if (a[n - 1] % x == 0) { int m = x; int i = 0; while (m < a[n - 1]) { if (a[i] < m) { i++; } else if (a[i] == m) { i++; m += x; } else { continue label; } } System.out.println(a[n - 1] / x); return; } } } }