import java.util.*; import java.io.*; public class beastbullies_roos { public static int n; public static long[] st,fsum, bsum; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(in.readLine()); if (n <= 2) { System.out.println(1); System.exit(0); } st = new long[n]; fsum = new long[n]; bsum = new long[n]; for (int i = 0; i < n; i++) { st[i] = Long.parseLong(in.readLine()); } Arrays.sort(st); // Find forward sums: fsum[0] = st[0]; for (int i = 1; i < n; i++) { fsum[i] = st[i] + fsum[i-1]; } // Find backward sums: bsum[n-1] = st[n-1]; for (int i = n-2; i >= 0; i--) { bsum[i] += st[i] + bsum[i+1]; } // The i-th animal will never vote to attack a weaker animal if the // i-th needs the weaker one to help defend against animals i+1,...,n-1 // in future self-defense actions. int min = n-1; int i = n-2; long sum = 0; while (i >= 0) { sum += st[i]; if (sum >= bsum[min]) { min = i; sum = 0; } i--; } System.out.println(n-min); } }