import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

/**
 * Works good for CF
 *
 * @author cykeltillsalu
 */
public class A111_div2 {

	// some local config
	static boolean test = false;
	static String testDataFile = "testdata.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solution
	private void solve() throws Throwable {

		int n = iread();

		int[] vals = new int[n];
		double tot = 0;
		for (int i = 0; i < n; i++) {
			int value = iread();
			vals[i] = value;
			tot += value;
		}

		Arrays.sort(vals);
		int pick = 0;
		int worth = 0;
		for (int i = vals.length - 1; i >= 0; i--) {
			worth += vals[i];
			pick ++;
			if(worth > tot/2.0d){
				break;
			}
		}

		out.write(pick + ENDL);
		out.flush();
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if (test) { // run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if (!readLine.equals("input")) {
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if (readLine.equals("output")) {
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case " + (++casenr) + ": ");

				new A111_div2().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if (readLine == null) {
						break out;
					}
					if (readLine.equals("input")) {
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new A111_div2().solve();
		}
		out.close();
	}

	public A111_div2() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {
		CF, OTHER
	};
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class AAA {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			sum += array[i];
		}

		int counter = 0;
		Arrays.sort(array);
		int first = 0;
		for (int j = n - 1; j >= 0; j--) {
			first += array[j];
			sum -= array[j];
			counter++;
			if (first > sum) {
				break;
			}
		}
		System.out.println(counter);
	}
}


import java.io.*;
import java.security.SecureRandom;
import java.util.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

    public void solve() throws Exception {
        int n = sc.nextInt();
        int a[] = new int[n];
        int s = 0;
        for (int i = 0;i < n; ++ i) {
            a[i] = sc.nextInt();
            s += a[i];
        }
        Arrays.sort(a);
        int s2 = 0;
        for (int i = n - 1;i >= 0; -- i) {
            s2 += a[i];
            if (s2 > s - s2) {
                out.println(n - i);
                break;
            }
        }

    }

    class Pair implements Comparable<Pair> {

        int x;
        int y;

        public Pair() {

        }

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Pair arg0) {
            if (x == arg0.x)
                return y - arg0.y;
            return x - arg0.x;
        }
    }

    /*--------------------------------------------------------------*/

    static String filename = "";
    static boolean fromFile = false;

    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    public static void main(String[] args) {
        new Thread(null, new Solution(), "", 1 << 25).start();
    }

    public void run() {
        try {
            init();
            solve();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            out.close();
        }
    }

    void init() throws Exception {
        if (fromFile) {
            in = new BufferedReader(new FileReader(filename+".in"));
            out = new PrintWriter(new FileWriter(filename+".out"));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
        sc = new FastScanner(in);
    }
}

class FastScanner {

    BufferedReader reader;
    StringTokenizer strTok;

    public FastScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            strTok = new StringTokenizer(reader.readLine());
        }

        return strTok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    public BigDecimal nextBigDecimal() throws IOException {
        return new BigDecimal(nextToken());
    }
}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author @listen
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
		int n = in.nextInt();
		int [] input = new int[n];
		int total = 0;
		for (int i = 0; i < n; ++i){
			input[i] = in.nextInt();
			total +=input[i];
		}
		Arrays.sort(input);
		int res = 0;
		int now = 0;
		for (int i = n - 1; i >= 0; --i){
			now += input[i];
			int left = total - now;
			++res;
			if (now > left){
				break;
			}
		}
		out.println(res);
		return;
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a implements Comparable<a>{

    int x, y, id;

    //static BufferedReader in;
    //static StringTokenizer st;

    public a(int x1, int y1, int id1){
        this.x = x1; this.y = y1; this.id = id1;
    }

    public int compareTo(a o) {
        return x - o.x;
    }

    static int n;
    static int arr[];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        //in = new BufferedReader(new InputStreamReader(System.in));
        //st = new StringTokenizer(""," ");
        int n = in.nextInt();
        arr = new int[n];
        int sum = 0;
        for (int i=0; i<n; i++){
            arr[i] = in.nextInt();
            sum +=arr[i];
        }
        Arrays.sort(arr);
        int sum2= 0;
        int ans = 0;
        for (int i=n-1; i>=0; i--){
            sum2+=arr[i];
            //System.out.println(sum2 + " " + sum);
            if (sum2>sum-sum2){
                ans = n - i;
                break;
            }
        }
        System.out.println(ans);
    }
}


import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class SolA {

	static Scanner in;
	static PrintWriter out;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);

		new SolA().run();

		in.close();
		out.close();

	}

	private void run() {
		int n = in.nextInt();
		int[] a = new int[n];
		int sum = 0;
		for(int i = 0; i < n; i++) {
			a[i] = in.nextInt();
			sum+=a[i];
		}
		Arrays.sort(a);
		int cs = 0;
		int kol = 0;
		for(int i = n - 1; i>=0; i--) {
			cs+=a[i];
			kol++;
			if (cs > sum - cs) {
				break;
			}
		}
		out.print(kol);
	}

}


import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class A
{
    public A()
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer mas[] = new Integer[n];
        int b = 0;
        for (int i = 0 ; i < n ; i ++)
        {
            mas[i] = sc.nextInt();
            b+=mas[i];
        }
        Arrays.sort(mas, new Comparator<Integer>()
        {

            @Override
            public int compare(Integer o1, Integer o2)
            {
                if(o1>o2)
                    return -1;
                else if(o1==o2)
                    return  0;
                else
                    return 1;
            }
        });
        int N = 0; int g = 0;
        for (int i = 0 ; i < n ; i ++)
        {
              g+=mas[i];
              if(g>(int)(b/2))
              {
                  System.out.println(i+1);
                  return;
              }
        }
        System.out.println(n);
    }
    public static void main(String[] args)
    {
        new A();
    }
}


import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

public class D {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] p = new int[n];
        for (int i = 0; i < a.length; i++)
            a[i] = p[i] = in.nextInt();
        Arrays.sort(a);

        int sum = 0;
        int t = 0;
        for (int i = 0; i < a.length; i++)
            t += a[i];
        int cnt = 0;
        for (int i = a.length - 1; i >= 0; i--) {
            cnt++;
            sum += a[i];
            if (t - sum < sum)
                break;
        }
        System.out.println(cnt);
    }
}


import java.io.*;
import java.util.*;

public class A
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	String FInput="";

	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{

			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}

	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}
		catch (NullPointerException e)
		{
			line=null;

		}

	}

	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	long NextLong()
	{
		String n = inputParser.nextToken();
		long val = Long.parseLong(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}

	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	public static void main(String [] argv)
	{
		String filePath=null;
		if(argv.length>0)filePath=argv[0];
		new A(filePath);
	}

	public void readFInput()
	{
		for(;;)
		{
			try
			{
				readNextLine();
				FInput+=line+" ";
			}
			catch(Exception e)
			{
				break;
			}
		}
		inputParser = new StringTokenizer(FInput, " ");
	}

	public A(String inputFile)
	{
		openInput(inputFile);

		readNextLine();
		int n=NextInt();

		int ret=0;
		int [] p = new int [n];
		readNextLine();
		int sum=0;
		for(int i=0; i<n; i++)
		{
			int a=NextInt();
			p[i]=a;
			sum+=a;
		}
		Arrays.sort(p);

		int my=0;

		for(int i=n-1; i>=0; i--)
		{
			my+=p[i];
			ret++;
			if(my*2>sum)break;
		}

		System.out.println(ret);
        closeInput();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;

public class R111_D2_A {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        // BufferedReader in = new BufferedReader(new
        // InputStreamReader(System.in));
        int n = in.readInt();
        int[] inp = new int[n];
        for (int i = 0; i < inp.length; i++) {
            inp[i] = in.readInt();
        }
        Arrays.sort(inp);
        int sum1 = 0;
        int res = 0;
        for (int i = inp.length - 1; i >= 0; i--) {
            sum1 += inp[i];
            res++;
            int sum2 = 0;
            for (int j = 0; j < i; j++) {
                sum2 += inp[j];
            }
            if (sum1 > sum2) {
                break;
            }
        }
        System.out.println(res);
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1000];
        private int curChar, numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0)
                s = readLine0();
            return s;
        }

        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines)
                return readLine();
            else
                return readLine0();
        }

        public char readCharacter() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            return (char) c;
        }

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
    }

}


	import java.util.*;
	public class A {
	public static void main(String args[]){
    Scanner in = new Scanner(System.in);
 int n=in.nextInt(),s=0;
 int[] a= new int[n];
 for (int i=0;i<n;i++) {a[i]=in.nextInt(); s+=a[i];}
 Arrays.sort(a); int k=0,ans=0;
 for (int i=n-1;i>=0;i--)
	 if (k<=s/2) {k+=a[i];ans++;}
 System.out.println(ans);

	    	}
		}


import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nova
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }
        Arrays.sort(a);
        int res = 0;
        int mySum = 0;
        int hisSum = sum;
        for (int i = n - 1; i >= 0; i--) {
            mySum += a[i];
            hisSum -= a[i];
            res++;
            if (mySum > hisSum) break;
        }
        out.println(res);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            writer.print(objects[i]);
        }
    }

    public void println(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}


//coded by : ariefianto17 | Reza Ariefianto

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	public static void main (String[]args)
	{
		Scanner read = new Scanner (new BufferedInputStream (System.in));
		int n = read.nextInt();
		int[]arr = new int[n];
		int sum=0;
		int sum2=0;
		int coin=0;
		for(int i=0;i<n;i++)
		{
			arr[i] = read.nextInt();
			sum+=arr[i];
		}
		Arrays.sort(arr);
		for(int i=n-1;i>=0;i--)
		{
			sum2+=arr[i];
			sum-=arr[i];
			coin++;
			if(sum2>sum)
				break;

		}
		System.out.println(coin);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class solver {
    FastScanner in = new FastScanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new solver().solve();
    }

    public void solve() {

        int n = in.nextInt();
        int[]tab = new int[n];

        int sum = 0;

        for (int i = 0; i < n; i++) {
            tab[i] = in.nextInt();
            sum += tab[i];
        }

        Arrays.sort(tab);
        int v1 = 0;
        int count = 0;

        for (int i = tab.length - 1; i >= 0; i--) {
            v1 += tab[i];
            count++;
            if (v1 > getSum(i, tab)) {
                break;
            }
        }

        out.println(count);

        in.close();
        out.close();
    }

    public int getSum(int index, int[]tab) {
        int sum = 0;
        for (int i = 0; i < index; i++) sum += tab[i];
        return sum;
    }

    public int max(int a, int b) {
        if (a > b) return a;
        else return b;
    }
}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    FastScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(in));
    }

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                System.err.println(e);
                return "";
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    float nextFloat() {
        return Float.parseFloat(next());
    }

    BigInteger nextBigInt() {
        return new BigInteger(next());
    }

    void close() {
        try {
            br.close();
        } catch (IOException e) {
        }
    }
}


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Scanner c=new Scanner(System.in);
		int N=c.nextInt();
		int A[]=new int[N];
		for(int i=0;i<N;i++)
			{
			A[i]=c.nextInt();
			}
		Arrays.sort(A);
		int sum=0;
		for(int i=0;i<N;i++)
			{
			sum+=A[i];
			}
		int my=0;
		int coins=0;
		for(int i=N-1;i>=0;i--)
			{
			coins++;			//include coin i
			my+=A[i];
			if(my>sum-my)
				{
				System.out.println(coins);
				break;
				}
			}
		}
	}

//must declare new classes here


import java.util.Arrays;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] A = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            A[i] = in.nextInt();
            sum += A[i];
        }
        Arrays.sort(A);
        int cnt = 0;
        int temp = 0;
        for (int i = n - 1; i >= 0; i--) {
            temp += A[i];
            sum -= A[i];
            cnt++;
            if (temp > sum)
                break;
        }
        System.out.println(cnt);
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class CF_111_A {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), sum = 0, sum2 = 0;
        int[] a = new int[n];
        for (int i = 0; i < n; i++){
            a[i] = in.nextInt();
            sum += a[i];
        }

        Arrays.sort(a);

        for (int i = n - 1; i >=0; i--){
            sum2 +=a[i];
            if (sum2 * 2 > sum){
                System.out.println(n - 1 - i + 1);
                System.exit(0);
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class A {

    int n;
    int[] a;
    public void run() throws IOException{
        Scanner s = new Scanner(new InputStreamReader(System.in));
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        n = s.nextInt();
        a =  new int[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = s.nextInt();
            sum+=a[i];
        }

        Arrays.sort(a);

        long mysum = 0;
        int count = 0;
        for (int i = n-1; i > -1; i--) {
            if (mysum > sum)
                break;

            count++;
            mysum+=a[i];
            sum-=a[i];
        }

        System.out.println(count);

    }

    public static void main(String[] args) throws IOException {
        (new A()).run();
    }

}


import java.io.*;
import java.util.*;

public class A {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    void solve() throws IOException {
        int n = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();

        Arrays.sort(a);

        int sum = 0;
        for (int i = 0; i < n; i++)
            sum += a[i];

        int cur = 0;
        for (int i = n - 1; i >= 0; i--) {
            cur += a[i];
            if (cur > sum - cur) {
                out.println(n - i);
                return;
            }
        }
    }

    void inp() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new A().inp();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    String nextString() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken("\n");
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}


import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int sum;
	int n;
	int arr[];

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			if(!input())
				break;
			solve();
		}
	}

	void solve() throws IOException
	{
		Arrays.sort(arr);
		int count = 0;
		int ans = 0;
		for(int i = n-1;i>=0;i--)
		{
			count+= arr[i];
			if(count>sum-count)
			{
				ans = n-i;
				break;
			}
		}
		System.out.println(ans);
	}

	boolean input() throws IOException
	{
		n = ni();
		sum = 0;
		arr = new int[n];
		for(int i = 0;i<n;i++)
		{
			arr[i] = ni();
			sum = sum+arr[i];
		}
		return true;
	}

}


import java.util.*;

public class A {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++) a[i] = s.nextInt();
		int r = 0, an = 0;
		Arrays.sort(a);
		int t = 0;
		for(int z : a) t += z;
		for(int i=a.length-1;i>=0;i--){
			r += a[i];
			an++;
			if (r > t - r) break;
		}
		System.out.println(an);
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution implements Runnable {

	public static void main(String[] args) {
		(new Thread(null, new Solution(), "1", 1l << 28)).start();
	}

	public void run() {
		try {
//			in = new BufferedReader(new FileReader("input.txt"));
//			out = new PrintWriter("output.txt");
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = null;

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			//if (!in.ready()) return null;
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	void solve() throws Exception {
		int n = nextInt();
		int[] a = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) sum += (a[i] = nextInt());
		Arrays.sort(a);
		int ans = 0;
		int s = 0;
		for (int i = n - 1; i >= 0; i--) {
			s += a[i]; ans++;
			if (2 * s > sum) break;
		}
		out.println(ans);
	}

}


import static java.lang.Math.*;
import java.util.*;
import java.io.*;

public class A {

    public void solve() throws Exception {

        int n = nextInt();
        int[] p = nextArr(n);
        Arrays.sort(p);
        int sum = 0;
        for (int i=0; i<n; ++i) sum+=p[i];
        int curr = 0;
        for (int i=n-1; i>=0; --i) {
            curr += p[i];
            if (curr>sum-curr) halt(n-i);
        }

    }

    ////////////////////////////////////////////////////////////////////////////

    boolean showDebug = true;
    static boolean useFiles = false;
    static String inFile = "input.txt";
    static String outFile = "output.txt";

    double EPS = 1e-7;
    int INF = Integer.MAX_VALUE;
    long INFL = Long.MAX_VALUE;
    double INFD = Double.MAX_VALUE;

    int absPos(int num) {
        return num<0 ? 0:num;
    }
    long absPos(long num) {
        return num<0 ? 0:num;
    }
    double absPos(double num) {
        return num<0 ? 0:num;
    }

    int min(int... nums) {
        int r = Integer.MAX_VALUE;
        for (int i: nums)
            if (i<r) r=i;
        return r;
    }
    int max(int... nums) {
        int r = Integer.MIN_VALUE;
        for (int i: nums)
            if (i>r) r=i;
        return r;
    }
    long minL(long... nums) {
        long r = Long.MAX_VALUE;
        for (long i: nums)
            if (i<r) r=i;
        return r;
    }
    long maxL(long... nums) {
        long r = Long.MIN_VALUE;
        for (long i: nums)
            if (i>r) r=i;
        return r;
    }
    double minD(double... nums) {
        double r = Double.MAX_VALUE;
        for (double i: nums)
            if (i<r) r=i;
        return r;
    }
    double maxD(double... nums) {
        double r = Double.MIN_VALUE;
        for (double i: nums)
            if (i>r) r=i;
        return r;
    }

    long sumArr(int[] arr) {
        long res = 0;
        for (int i: arr)
            res+=i;
        return res;
    }
    long sumArr(long[] arr) {
        long res = 0;
        for (long i: arr)
            res+=i;
        return res;
    }
    double sumArr(double[] arr) {
        double res = 0;
        for (double i: arr)
            res+=i;
        return res;
    }

    long partsFitCnt(long partSize, long wholeSize) {
        return (partSize+wholeSize-1)/partSize;
    }

    boolean odd(long num) {
        return (num&1)==1;
    }

    boolean hasBit(int num, int pos) {
        return (num&(1<<pos))>0;
    }

    long binpow(long a, int n) {
        long r = 1;
        while (n>0) {
            if ((n&1)!=0) r*=a;
            a*=a;
            n>>=1;
        }
        return r;
    }

    boolean isLetter(char c) {
        return (c>='a' && c<='z') || (c>='A' && c<='Z');
    }
    boolean isLowercase(char c) {
        return (c>='a' && c<='z');
    }
    boolean isUppercase(char c) {
        return (c>='A' && c<='Z');
    }
    boolean isDigit(char c) {
        return (c>='0' && c<='9');
    }

    boolean charIn(String chars, String s) {
        if (s==null) return false;
        if (chars==null || chars.equals("")) return true;
        for (int i=0; i<s.length(); ++i)
            for (int j=0; j<chars.length(); ++j)
                if (chars.charAt(j)==s.charAt(i)) return true;
        return false;
    }

    String stringn(String s, int n) {
        if (n<1 || s==null) return "";
        StringBuilder sb = new StringBuilder(s.length()*n);
        for (int i=0; i<n; ++i) sb.append(s);
        return sb.toString();
    }
    String str(Object o) {
        if (o==null) return "";
        return o.toString();
    }

    long timer = System.currentTimeMillis();
    void startTimer() {
        timer = System.currentTimeMillis();
    }
    void stopTimer() {
        System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);
    }

    static class InputReader {
        private byte[] buf;
        private int bufPos = 0, bufLim = -1;
        private InputStream stream;
        public InputReader(InputStream stream, int size) {
            buf = new byte[size];
            this.stream = stream;
        }
        private void fillBuf() throws IOException {
            bufLim = stream.read(buf);
            bufPos = 0;
        }
        char read() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return (char)buf[bufPos++];
        }
        boolean hasInput() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return bufPos<bufLim;
        }
    }

    static InputReader inputReader;
    static BufferedWriter outputWriter;

    char nextChar() throws IOException {
        return inputReader.read();
    }
    char nextNonWhitespaceChar() throws IOException {
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        return c;
    }
    String nextWord() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c>' ') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    String nextLine() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c!='\n' && c!='\r') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    int nextInt() throws IOException {
        int r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r=c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10;
            r+=c-48;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    long nextLong() throws IOException {
        long r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r = c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10L;
            r+=c-48L;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextWord());
    }
    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextInt();
        return arr;
    }
    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextLong();
        return arr;
    }
    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextDouble();
        return arr;
    }
    String[] nextArrS(int size) throws NumberFormatException, IOException {
        String[] arr = new String[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextWord();
        return arr;
    }
    char[] nextArrCh(int size) throws IOException {
        char[] arr = new char[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrCh(int rows, int columns) throws IOException {
        char[][] arr = new char[rows][columns];
        for (int i=0; i<rows; ++i)
            for (int j=0; j<columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {
        char[][] arr = new char[rows+2][columns+2];
        for (int i=1; i<=rows; ++i)
            for (int j=1; j<=columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        for (int i=0; i<columns+2; ++i) {
            arr[0][i] = border;
            arr[rows+1][i] = border;
        }
        for (int i=0; i<rows+2; ++i) {
            arr[i][0] = border;
            arr[i][columns+1] = border;
        }
        return arr;
    }

    void printf(String format, Object... args) throws IOException {
        outputWriter.write(String.format(format, args));
    }
    void print(Object o) throws IOException {
        outputWriter.write(o.toString());
    }
    void println(Object o) throws IOException {
        outputWriter.write(o.toString());
        outputWriter.newLine();
    }
    void print(Object... o) throws IOException {
        for (int i=0; i<o.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(o[i].toString());
        }
    }
    void println(Object... o) throws IOException {
        print(o);
        outputWriter.newLine();
    }
    void printn(Object o, int n) throws IOException {
        String s = o.toString();
        for (int i=0; i<n; ++i) {
            outputWriter.write(s);
            if (i!=n-1) outputWriter.write(' ');
        }
    }
    void printnln(Object o, int n) throws IOException {
        printn(o, n);
        outputWriter.newLine();
    }
    void printArr(int[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Integer.toString(arr[i]));
        }
    }
    void printArr(long[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Long.toString(arr[i]));
        }
    }
    void printArr(double[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Double.toString(arr[i]));
        }
    }
    void printArr(String[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(arr[i]);
        }
    }
    void printArr(char[] arr) throws IOException {
        for (char c: arr) outputWriter.write(c);
    }
    void printlnArr(int[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(long[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(double[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(String[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(char[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void halt(Object... o) throws IOException {
        if (o.length!=0) println(o);
        outputWriter.flush(); outputWriter.close();
        System.exit(0);
    }

    void debug(Object... o) {
        if (showDebug) System.err.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.US);
        if (!useFiles) {
            inputReader = new InputReader(System.in, 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);
        } else {
            inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);
        }
        new A().solve();
        outputWriter.flush(); outputWriter.close();
    }
}


//Edwin Lunando template for online algorithm contest
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {

//  class node implements Comparable<node> {
//
//    public int a;
//    public int b;
//
//    public int compareTo(node a) {
//      if (a.b == this.b) {
//        return a.a - this.a;
//      } else {
//        return a.b - this.b;
//      }
//    }
//
//    public node(int a, int b) {
//      this.a = a;
//      this.b = b;
//    }
//  }

  private void solve() throws IOException {
    int n = nextInt();
    int[] arr = new int[n];
    int count = 0;
    for (int x = 0; x < n; x++) {
      arr[x] = nextInt();
      count+= arr[x];
    }
    Arrays.sort(arr);
    count /=2;
    int result = 0, sum = 0;
    for (int x = arr.length - 1; x >= 0; x--) {
      sum += arr[x];
      result++;
      if (sum > count) {
        break;
      }
    }
    System.out.println(result);
  }

  public static void main(String[] args) {
    try {
      br = new BufferedReader(new InputStreamReader(System.in));
      //br = new BufferedReader(new FileReader("input.txt"));
      out = new PrintWriter(System.out);
      //out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
      new Main().solve();
      out.close();
    } catch (Throwable e) {
      System.out.println(e);
      System.exit(239);
    }
  }
  static BufferedReader br;
  static StringTokenizer st;
  static PrintWriter out;

  static String nextToken() throws IOException {
    while (st == null || !st.hasMoreTokens()) {
      String line = br.readLine();
      if (line == null) {
        return null;
      }
      st = new StringTokenizer(line);
    }
    return st.nextToken();
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(nextToken());
  }

  static long nextLong() throws IOException {
    return Long.parseLong(nextToken());
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(nextToken());
  }

  static int[] nextIntArray(int n) throws IOException {
    int[] temp = new int[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextInt();
    }
    return temp;
  }

  static long[] nextLongArray(int n) throws IOException {
    long[] temp = new long[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextLong();
    }
    return temp;
  }

  static String[] nextArray(int n) throws IOException {
    String[] temp = new String[n];
    for (int x = 0; x < n; x++) {
      temp[x] = nextToken();
    }
    return temp;
  }
}


import java.io.*;
import java.util.*;

public class A implements Runnable {
    private MyScanner in;
    private PrintWriter out;

    private void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        int all = 0;
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
            all += a[i];
        }
        Arrays.sort(a);
        int sum = 0, ans = 0;
        for (int i = n - 1; i >= 0; --i) {
            sum += a[i];
            ++ans;
            if (sum > all - sum) {
                break;
            }
        }
        out.println(ans);
    }

    @Override
    public void run() {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    public static void main(String[] args) {
        new A().run();
    }

    static class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            try {
                st = null;
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public boolean hasNext() {
            if (st != null && st.hasMoreTokens()) {
                return true;
            }
            try {
                while (br.ready()) {
                    st = new StringTokenizer(br.readLine());
                    if (st != null && st.hasMoreTokens()) {
                        return true;
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            return false;
        }
    }
}


import java.util.*;
public class codeee {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n==1){System.out.println(1); return;}
        int []mas=new int[n];
        int sum=0;
        for (int i = 0; i < n; i++) {
            mas[i]=sc.nextInt();
            sum+=mas[i];
        }
        Arrays.sort(mas);
        int sum1=0;
        int ans=0;
        for(int i=0;i<n;i++){
            sum1+=mas[n-i-1];
            if(sum1>(sum-sum1)){
                ans=i;
                break;
            }
        }
        System.out.println(ans+1);
    }
}


import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author codeKNIGHT
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n=in.nextInt(),i,sum=0;
        int a[]=new int[n];
        for(i=0;i<n;i++)  {

            a[i]=in.nextInt();
            sum+=a[i];
        }
        Arrays.sort(a);
        int s=0,c=0;
        for(i=n-1;i>=0;i--)
        {
            if(s>sum)
                break;
            s+=a[i];
            sum-=a[i];

                        c++;
        }
        out.println(c);
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main implements Runnable {
    PrintWriter out;
    BufferedReader in;
    StringTokenizer st;

    void solve() throws Exception {
        int n = nextInt();
        int[] a = new int[n];
        int sum = 0;
        for(int i = 0; i < n; ++i) {
            a[i] = nextInt();
            sum += a[i];
        }
        Arrays.sort(a);
        int ans = 0, csum = 0;
        for(int i = n - 1; csum <= sum - csum && i >= 0; i--) {
            csum += a[i];
            ans++;
        }
        out.println(ans);
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//          in = new BufferedReader(new FileReader("input.txt"));
//          out = new PrintWriter("output.txt");
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    static public void main(String args[]) throws Exception {
        (new Main()).run();
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    String nextToken() {
        while(st == null || !st.hasMoreTokens()) {
            try {
                String line = in.readLine();
                st = new StringTokenizer(line);
            } catch(Exception e) {
                return null;
            }
        }
        return st.nextToken();
    }
}


import java.util.*;
public class Solution {
    public static void main(String [] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] a = new int [n];
        int i;
        int s = 0;
        for (i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            s += a[i];
        }
        Arrays.sort(a);
        int sum = 0;
        for (i = n - 1; i > -1; i--) {
            sum += a[i];
            if (s - sum < sum) {
                System.out.println(n - i);
                return;
            }
        }
    }
}


 import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

    public class Test {
            static BufferedReader reader;
            static StringTokenizer tokenizer;
            static PrintWriter writer;

            static int nextInt() throws IOException {
                    return Integer.parseInt(nextToken());
            }

            static long nextLong() throws IOException {
                    return Long.parseLong(nextToken());
            }

            static double nextDouble() throws IOException {
                    return Double.parseDouble(nextToken());
            }

            static String nextToken() throws IOException {
                    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                            tokenizer = new StringTokenizer(reader.readLine());
                    }
                    return tokenizer.nextToken();
            }

            public static void main(String[] args) throws IOException {
                    reader = new BufferedReader(new InputStreamReader(System.in));
                    tokenizer = null;
                    writer = new PrintWriter(System.out);
                    solve();
                    reader.close();
                    writer.close();
            }

            private static void solve() throws IOException {
                int n=nextInt();
                int[] a=new int[n];
                int first=0;
                for (int i=0;i<n;i++)
                {
                    a[i]=nextInt();
                    first+=a[i];
                }
                Arrays.sort(a);
                int ans=1;
                int last=a[n-1];
                first-=a[n-ans];
                while (true)
                {
                    if (first<last)
                        break;
                    ans++;
                    last+=a[n-ans];
                    first-=a[n-ans];
                }
                writer.print(ans);
            }

    }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class AA implements Runnable {
	public static void main(String[] args) {
		new Thread(new AA()).run();

	}

	static class Utils {

		private Utils() {
		}

		public static void mergeSort(int[] a) {
			mergeSort(a, 0, a.length - 1);
		}

		private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
			final int MAGIC_VALUE = 50;
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergeSort(a, leftIndex, middleIndex);
					mergeSort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex,
				int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++]
							: rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}

	BufferedReader br;
	StringTokenizer str = new StringTokenizer("");
	PrintWriter pw;

	public Integer ni() {
		return Integer.parseInt(nextToken());
	}

	public Double nd() {
		return Double.parseDouble(nextToken());
	}

	public Long nl() {
		return Long.parseLong(nextToken());
	}

	public boolean EOF() {
		try {
			if (!br.ready() && !str.hasMoreTokens()) {
				return true;
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public String nextToken() {
		while (!str.hasMoreTokens())
			try {
				str = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		return str.nextToken();

	}

	@Override
	public void run() {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new OutputStreamWriter(System.out));
		// try {
		// br = new BufferedReader(new FileReader("input.txt"));
		// } catch (FileNotFoundException e) {
		// e.printStackTrace();
		// }
		// try {
		// pw = new PrintWriter(new FileWriter("output.txt"));
		// } catch (IOException e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// }
		solve();
		pw.close();
	}

	public void solve() {

		int n = ni();
		int[] a = new int[n];
		int total = 0;
		for (int i = 0; i < n; i++) {
			a[i] = ni();
			total+=a[i];
		}
		Arrays.sort(a);
		int c =0;
		int left=0;
		for(int i=n-1; i>=0;i--){
			if (left<=total){
				c++;
				left+=a[i];
				total-=a[i];
			}
		}
		pw.print(c);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Round111A {

    public static void main(String[] args) throws IOException {
        new Round111A().run();
    }

    public void run() throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        Scanner scanner = new Scanner(reader);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int sum = 0;
        Integer[] a = new Integer[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            sum += a[i];
        }
        Arrays.sort(a, Collections.reverseOrder());

        int s = 0;
        int i = 0;
        while (i < n && (s <= sum / 2)) {
            s += a[i];
            i++;
        }

        writer.print(i);

        scanner.close();
        writer.close();
    }
}


import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class C111A{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n = toInt();
        int nm[] = toIntArray();
        double a=0.0;
        double sum=0;
        for(int i=0;i<n;i++){
            sum+=nm[i];
        }
        a=sum/2;
        Arrays.sort(nm);
        int cur=0;
        int count=0;
        for(int i=nm.length-1;i>=0;i--){
            cur+=nm[i];
            count++;
            if(cur>a){
                break;
            }
        }
        System.out.println(count);

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.io.*;
import java.util.*;

public class A {

	public A () throws IOException {
		int N = sc.nextInt();
		int [] A = new int [N];
		for (int n = 0; n < N; ++n)
			A[n] = sc.nextInt();
		solve(N, A);
	}

	public void solve (int N, int [] A) {
		//start();
		Arrays.sort(A);
		int S1 = 0;
		for (int n = 0; n < N; ++n)
			S1 += A[n];

		int S2 = 0;
		for (int n = N - 1; n >= 0; --n) {
			S2 += A[n];
			if (S2 > S1 - S2)
				exit(N - n);
		}
	}

	////////////////////////////////////////////////////////////////////////////////////

	static MyScanner sc;
	static long t;

	static void print (Object o) {
		System.out.println(o);
	}

	static void exit (Object o) {
		print(o);
		//print2((millis() - t) / 1000.0);
		System.exit(0);
	}

	static void run () throws IOException {
		sc = new MyScanner ();
		new A();
	}

	public static void main(String[] args) throws IOException {
		run();
	}

	static long millis() {
		return System.currentTimeMillis();
	}

	static void start() {
		t = millis();
	}

	static class MyScanner {
		String next() throws IOException {
			newLine();
			return line[index++];
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		String nextLine() throws IOException {
			line = null;
			return r.readLine();
		}

		//////////////////////////////////////////////

		private final BufferedReader r;

		MyScanner () throws IOException {
			this(new BufferedReader(new InputStreamReader(System.in)));
		}

		MyScanner(BufferedReader r) throws IOException {
			this.r = r;
			newLine();
		}

		private String [] line;
		private int index;

		private void newLine() throws IOException {
			if (line == null || index == line.length) {
				line = r.readLine().split(" ");
				index = 0;
			}
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solver {

    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws NumberFormatException, IOException {
        Solver solver = new Solver();
        solver.open();
        solver.solve();
        solver.close();
    }

    public void open() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    public void solve() throws NumberFormatException, IOException {
        int n = nextInt();

        int[] ar = new int[n];
        int sum = 0;

        for (int i=0;i<n;i++){
            ar[i]=nextInt();
            sum+=ar[i];
        }

        Arrays.sort(ar);

        int me = 0;
        int k = 0;
        while (me<=sum){
            k++;
            int coin = ar[ar.length-k];
            me += coin;
            sum -= coin;
        }

        out.println(k);
    }

    public void close() {
        out.flush();
        out.close();
    }

}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class A implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	@Override
	public void run() {
		try {
			long startTime = System.currentTimeMillis();
			if (ONLINE_JUDGE) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			}
			tok = new StringTokenizer("");
			Locale.setDefault(Locale.US);
			solve();
			in.close();
			out.close();
			long endTime = System.currentTimeMillis();
			long totalMemory = Runtime.getRuntime().totalMemory();
			long freeMemory = Runtime.getRuntime().freeMemory();
			System.err.println("Time = " + (endTime - startTime) + " ms");
			System.err.println("Memory = " + ((totalMemory - freeMemory) / 1024) + " KB");
		} catch (Throwable e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	void debug(Object... o) {
		if (!ONLINE_JUDGE) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new A(), "", 256 * 1024 * 1024).start();
	}

	static class Utils {

		private Utils() {}

		public static void mergeSort(int[] a) {
			mergeSort(a, 0, a.length - 1);
		}

		private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
			final int MAGIC_VALUE = 50;
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergeSort(a, leftIndex, middleIndex);
					mergeSort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}

//------------------------------------------------------------------------------

	void solve() throws IOException {
		int n = readInt();
		int[] a = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = readInt();
			sum += a[i];
		}
		Utils.mergeSort(a);
		int s = 0, c = 0;
		for (int i = n-1; i >= 0; i--) {
			s += a[i];
			c++;
			if (2 * s > sum) {
				break;
			}
		}
		out.println(c);

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class con111_A {

    public static void main( final String[] args ) throws IOException {
        final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        final int n = Integer.parseInt( br.readLine() );
        final int[] a = new int[n];
        final String[] parts = br.readLine().split( " " );
        for ( int i = 0; i < n; ++i ) {
            a[ i ] = Integer.parseInt( parts[ i ] );
        }
        System.out.println( solve( n, a ) );
    }

    private static int solve( final int n, final int[] a ) {
        Arrays.sort( a );
        int sum = 0;
        for ( int i = 0; i < n; ++i ) {
            sum += a[ i ];
        }
        int res = 0;
        int ms = 0;
        for ( int i = n - 1; i >= 0; --i ) {
            if ( ms > sum / 2 ) {
                break;
            } else {
                ms += a[ i ];
                ++res;
            }
        }
        return res;
    }

}


import java.util.Arrays;
import java.util.Scanner;

public class Twins {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] val = new int[n];
        for (int i=0; i<n; i++)
            val[i] = in.nextInt();
        Arrays.sort(val);
        int sum = 0, count = 0;
        for (int i=n-1; i>=0; i--)  {
            count++;
            sum += val[i];
            int his = 0;
            for (int j=0; j<i; j++) his += val[j];
            if (his < sum)  break;
        }
        System.out.println(count);
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Round111ProbA {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int[]a = new int[n];
        int s =0;
        for(int i =0 ; i < n;i++)
        {
            a[i] = in.nextInt();
            s += a[i];
        }
        Arrays.sort(a);
        int x =0;
        int c =0;
        for(int i =n-1 ; i >-1;i-- )
        {
            x +=a[i];
            s -= a[i];
            c++;
            if(x > s)break;
        }
        System.out.println(c);
    }

}


import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class A111
{
     public static void main(String args[])throws Exception
     {
         Scanner in=new Scanner(System.in);
         // br=new BufferedReader(new InputStreamReader(System.in));
         PrintWriter pw=new PrintWriter(System.out);
         int n,i,j,k=0,l;
         n=in.nextInt();
         int a[]=new int[n];
         int sum=0,sum1=0;
         for(i=0;i<n;i++)
         {
            a[i]=in.nextInt();
            sum+=a[i];
            }
            Arrays.sort(a);
         for(j=n-1;j>=0;j--)
         {
             sum1+=a[j];
             k++;
             if(sum1*2>sum)
             break;
            }
            pw.println(k);
         pw.flush();
     }
}


import java.util.Arrays;
import java.util.Scanner;

public class round111A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] coins = new int [n];
        for(int i = 0 ; i < n ; ++i)
            coins[i] = sc.nextInt();
        Arrays.sort(coins);
        int ans = (int)1e9;
        for(int i = 1 ; i <= n ; ++i){
            int sum1 = 0;
            int c = 0;
            int j = n - 1;
            for(j = n - 1 ; j >= 0 && c < i ; --j, ++c){
                sum1 += coins[j];
            }
            int sum2 = 0;
            for(int k = 0 ; k <= j ; ++k)
                sum2 += coins[k];
            if(sum1 > sum2){
                System.out.println(i);
                return;
            }
        }
    }
}


import java.util.*;

public class TaskA {

    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        Arrays.sort(a);

        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
        }

        int take = 0, num = 0;

        for (int i = n - 1; i > -1; i--) {
            num++;
            take += a[i];
            sum -= a[i];
            if (take > sum) {
                break;
            }
        }

        System.out.println(num);
    }
}


import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class nA {

    Scanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int a[] = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum+=a[i];
        }
        Arrays.sort(a);
        int nowsum = 0;
        int kol = 0;
        for(int i = n - 1; i >= 0; i--){
            if(nowsum <= sum / 2){
                nowsum+=a[i];
                kol++;
            }else{
                break;
            }
        }
        out.println(kol);
    }

    void run() {
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        try {
            solve();
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new nA().run();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Andrew Porokhin, andrew.porokhin@gmail.com
 */
public class Problem111A implements Runnable {
    void solve() throws NumberFormatException, IOException {
        // TODO: Write your code here ...
        final int n = nextInt();
        final int[] a = new int[n];

        long sum = 0;
        for (int i = 0; i < n; i++) {
            final int nextInt = nextInt();
            sum += nextInt;
            a[i] = nextInt;
        }

        Arrays.sort(a);
        int currSum = 0;
        int maxCoins = 0;
        for (int j = a.length - 1; j >= 0; j--) {
            currSum += a[j];
            maxCoins++;
            if (sum - currSum < currSum) {
                break;
            }
        }
        System.out.println(maxCoins);
    }

    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) {
        // Introduce thread in order to increase stack size
        new Problem111A().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
        } catch (Exception e) {
            System.exit(9000);
        } finally {
            out.flush();
            out.close();
        }
    }

    String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Testt {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Testt().run();
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (leftIndex < rightIndex) {
            if (rightIndex - leftIndex <= MAGIC_VALUE) {
                insertionSort(a, leftIndex, rightIndex);
            } else {
                int middleIndex = (leftIndex + rightIndex) / 2;
                mergeSort(a, leftIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, leftIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int leftIndex, int middleIndex,
            int rightIndex) {
        int length1 = middleIndex - leftIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] leftArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, leftIndex, leftArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = leftArray[i++];
            } else {
                a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
        for (int i = leftIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= leftIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    public void solve() throws IOException {

        int n  = readInt();
        int [] a = new int [n];
        for (int i = 0; i < n; i++){
            a[i] = readInt();
        }
        mergeSort(a);

        int sum = 0;
        for (int i = 0; i <n; i++){
            sum+=a[i];
        }
        int sum2 = 0;
        int ans = 0;
        for (int i = n-1; i >=0; i-- ){
            sum2+=a[i];
            sum-=a[i];
            ans++;
            if (sum2>sum){
                break;
            }
        }

        out.print(ans);
    }
/*  for (int i =0; i<n; i++){
        out.print(a[i]+" ");
    }*/
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.Map.*;
public class codeforces {
     static int count =0;
     static boolean f=false;
     static int [] arr;
	static 	PrintWriter pw=new PrintWriter(System.out);
	static void solve(int index , int mask) {
		if(index==arr.length) {
			int sum1=0; int sum2=0;
			for(int i=0;i<arr.length;i++) {
				if((mask & 1<<i)!=0) sum1+=arr[i];

			}
			return;
		}
		solve(index+1, mask | 1<<index);
		solve(index+1, mask);
	}
	public static void main(String [] args) throws IOException, InterruptedException {
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		pair [] arr=new pair[x];
		for(int i=0;i<x;i++) arr[i]=new pair(i, sc.nextInt(),0);
		for(int i=0;i<x;i++) arr[i].y=sc.nextInt();
		Arrays.sort(arr);
		PriorityQueue<Integer> qq=new PriorityQueue<>();
		//pw.println(Arrays.toString(arr));
		Long [] list=new Long [x];
		long sum=0;
		for(int i=0;i<x;i++) {
			pair w=arr[i];
			if(qq.size()<y) {
				qq.add(w.y);
				sum+=w.y;
				list[w.i]=sum;

			}else if(!qq.isEmpty()) {
				sum+=w.y;
				list[w.i]=sum;
				int first=qq.poll();
				if(w.y>first) {
					sum-=first;
					qq.add(w.y);
				}else {
					qq.add(first);
					sum-=w.y;
				}
			} else list[w.i]=(long) w.y;
			//pw.println(qq);
		}
		for(Long w:list) pw.print(w+" ");
		pw.flush();
		pw.close();
	}

	static class pair implements Comparable<pair>{
		String  name; int x,y,i ;
		public pair(String name , int x) {
			this.name=name; this.x=x;
		}

		public pair (int i,int x,int y) {
			this.i=i; this.x=x; this.y=y;
		}
		public int compareTo(pair o) {
			return x-o.x;
		}
		public int compareTo1(pair o) {
			if(!name.equals(o.name))
				return name.compareTo(o.name);
			return x-o.x;
		}
		public String toString() {
			return i+" "+x+" "+y;
		}
	}

   static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;

public class Main {
	static StreamTokenizer st=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	public static void main(String[] args) {
		int n=nextInt();
		int m=nextInt();
		long b[]=new long[n];
		long g[]=new long[m];
		for(int i=0;i<n;i++)
			b[i]=nextInt();
		for(int i=0;i<m;i++)
			g[i]=nextInt();
		Arrays.sort(b);
		Arrays.sort(g);
		if(b[n-1]>g[0])
			System.out.println("-1");
		else if(b[n-1]==g[0]){
			long sum=0;
			for(int i=0;i<m;i++)
				sum+=g[i];
			for(int i=0;i<n-1;i++){
				sum+=(m*b[i]);
			}
			System.out.println(sum);
		}else{
			long sum=0;
			for(int i=0;i<m;i++)
				sum+=g[i];
			sum+=b[n-1];
			sum+=(b[n-2]*(m-1));
			for(int i=0;i<n-2;i++){
				sum+=(m*b[i]);
			}
			System.out.println(sum);
		}
	}
	static int nextInt(){
		try {
			st.nextToken();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return (int)st.nval;
	}
}


import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new PrintStream(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        long[] arrB = new long[n];
        long[] arrG = new long[m];
        st=new StringTokenizer(f.readLine());
        for(int i=0;i<n;i++){
            arrB[i]=Long.parseLong(st.nextToken());
        }
        st=new StringTokenizer(f.readLine());
        for(int j=0;j<m;j++){
            arrG[j]=Long.parseLong(st.nextToken());
        }
        Arrays.sort(arrB);
        Arrays.sort(arrG);
        long ans = 0;
//        for (int i = 0; i < n; i++) ans += arrB[i] * m;
//        for (int i = 0; i < m - 1; i++) ans += arrG[i] - arrB[0];
//        if (arrB[m - 1] != arrB[0]) {
//            if (arrB.length == 1) {
//                ans=-1;
//            }
//            else ans += arrG[m - 1] - arrB[1];
//        }
//        if (arrG[m-1] < arrB[0]) {
//            ans=-1;
//        }
        for(int i=0;i<n;i++){
            ans+=arrB[i]*(long)m;
        }
        for(int i=1;i<m;i++){
            ans+=arrG[i]-arrB[n-1];
        }
        if(arrB[n-1]!=arrG[0]){
            if(n==1){
                ans=-1;
            }
            else{
                //smallest g goes to second to last
                ans+=arrG[0]-arrB[n-2];
            }
        }
        if(arrB[n-1]>arrG[0]){
            ans=-1;
        }
        System.out.println(ans);
        f.close();
        out.close();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;

public class Main {
	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws NumberFormatException, IOException {
		String[] s = br.readLine().trim().split(" ");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		long b[] = new long[n];
		s = br.readLine().trim().split(" ");
		for(int i = 0; i < n; i++) {
			b[i] = Integer.parseInt(s[i]);
		}
		long g[] = new long[m];
		s = br.readLine().trim().split(" ");
		for(int i = 0; i < m; i++) {
			g[i] = Integer.parseInt(s[i]);
		}
		Arrays.sort(b);
		Arrays.sort(g);
		if(g[0] < b[n-1]) {
			System.out.println("-1");
		}
		else if(g[0] == b[n-1]){
			long ans = 0;
			for(int i = 0; i < m; i++) {
				ans += g[i];
			}
			for(int i = 0; i < n-1; i++) {
				ans += (m)*b[i];
			}
			System.out.println(ans);

		}
		else {
			long ans = 0;
			for(int i = 0; i < m; i++) {
				ans += g[i];
			}
			for(int i = 0; i < n-1; i++) {
				ans += (m)*b[i];
			}
			ans += b[n-1]-b[n-2];
			System.out.println(ans);

		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Math.*;

public class Main2 {

    private FastScanner scanner = new FastScanner();

    public static void main(String[] args) {
        new Main2().solve();
    }

    private void solve() {

        int n = scanner.nextInt();

        int a[][] = new int[n][3];

        for (int i = 0; i < n; i++) {
            a[i][0] = scanner.nextInt();
            a[i][1] = scanner.nextInt();
            a[i][2] = i;
        }

        int l = -1, r = -1;

        Arrays.sort(a, (o1, o2) -> {
            if (o1[0] != o2[0]) {
                return o1[0] - o2[0];
            } else {
                return o2[1] - o1[1];
            }
        });

        int maxr = -1, maxi = -1;
        for (int i = 0; i < n; i++) {
            if (a[i][1] <= maxr) {
                l = a[i][2] + 1;
                r = maxi + 1;
                break;
            }
            if (a[i][1] > maxr) {
                maxi = a[i][2];
                maxr = a[i][1];
            }
        }

        System.out.println(l + " " + r);

    }

    boolean check(int cnt[][], int[] tcnt, int mid) {
        boolean ok = true;

        for (int j = 0; j < 27; j++) {
            if (cnt[mid][j] < tcnt[j]) {
                ok = false;
            }
        }
        return ok;
    }

    class Pair {
        int c, f;
    }

    class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        FastScanner() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();

        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        Integer[] nextA(int n) {
            Integer a[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            return a;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        team[] t = new team[n];
        for (int i = 0; i < n; i++)
            t[i] = new team(in.nextInt(), in.nextInt());
        Arrays.sort(t);
        int cnt = 0;
        team tm = t[t.length - k];
        for (int i = t.length - 1; i >= 0; i--)
            if (tm.equal(t[i]))
                cnt++;
        System.out.println(cnt);
    }

    static class team implements Comparable<team> {
        int p, t;

        public team(int pp, int tt) {
            p = pp;
            t = tt;
        }

        @Override
        public int compareTo(team o) {
            if (p == o.p)
                return o.t - t;
            return p - o.p;
        }

        public boolean equal(team a) {
            return a.p == p && a.t == t;
        }
    }
}


import java.awt.Point;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt() - 1;
        Point[] A = new Point[n];
        for (int i = 0; i < n; i++)
            A[i] = new Point(in.nextInt(), in.nextInt());
        Arrays.sort(A, new Comparator<Point>() {
            public int compare(Point o1, Point o2) {
                if (o1.x != o2.x)
                    return o2.x - o1.x;
                if (o1.y != o2.y)
                    return o1.y - o2.y;
                return 0;
            }
        });
        int i = k;
        int j = k;
        while (i >= 0 && A[i].x == A[k].x && A[i].y == A[k].y)
            i--;
        while (j < n && A[j].x == A[k].x && A[j].y == A[k].y)
            j++;
        System.out.println(j - i - 1);
    }
}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class CF113_Div2_A implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null);

	public static void main(String[] args) {
		new Thread(null, new CF113_Div2_A(), "", 256 * (1L << 20)).start();
	}

	@Override
	public void run() {
		try {
			long startTime = System.currentTimeMillis();
			if (ONLINE_JUDGE) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			}
			Locale.setDefault(Locale.US);
			tok = new StringTokenizer("");
			solve();
			in.close();
			out.close();
			long endTime = System.currentTimeMillis();
			System.err.println("Time = " + (endTime - startTime));
			long freeMemory = Runtime.getRuntime().freeMemory();
			long totalMemory = Runtime.getRuntime().totalMemory();
			System.err.println("Memory = " + ((totalMemory - freeMemory) >> 10));
		} catch (Throwable t) {
			t.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	/** http://pastebin.com/j0xdUjDn */
	static class Utils {

		private Utils() {}

		public static void mergeSort(int[] a) {
			mergeSort(a, 0, a.length - 1);
		}

		private static final int MAGIC_VALUE = 50;

		private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergeSort(a, leftIndex, middleIndex);
					mergeSort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}

	void debug(Object... o) {
		if (!ONLINE_JUDGE) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	// solution

	class Team implements Comparable<Team>{
		int cnt, time;

		public Team(int cnt, int time) {
			this.cnt = cnt;
			this.time = time;
		}

		@Override
		public int compareTo(Team x) {
			if (cnt == x.cnt) return time - x.time;
			return x.cnt - cnt;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + getOuterType().hashCode();
			result = prime * result + cnt;
			result = prime * result + time;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Team other = (Team) obj;
			if (!getOuterType().equals(other.getOuterType()))
				return false;
			if (cnt != other.cnt)
				return false;
			if (time != other.time)
				return false;
			return true;
		}

		private CF113_Div2_A getOuterType() {
			return CF113_Div2_A.this;
		}

	}

	void solve() throws IOException {
		int n = readInt();
		int k = readInt();
		k--;
		Team[] a = new Team[n];
		for (int i =0 ; i < n; i++) {
			a[i] = new Team(readInt(), readInt());
		}
		Arrays.sort(a);
		int res = 1;
		for (int i = k-1; i >= 0; i--) {
			if (a[k].equals(a[i])) res++;
		}
		for (int i = k+1; i < n; i++) {
			if (a[k].equals(a[i])) res++;
		}
		out.print(res);

	}

}


import java.util.Scanner;

public class R113A {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), k = in.nextInt();
        int[] ind = new int[n];
        int[] p = new int[n];
        int[] t = new int[n];
        for (int i = 0; i < n; i++){
            ind[i] = i;
            p[i] = in.nextInt();
            t[i] = in.nextInt();
        }
        //System.out.println("erwer");
        for (int i = 0; i < n - 1; i++)
         for (int j = i + 1; j < n; j++){
             if (p[i] < p[j] || (p[i] == p[j] && t[i] > t[j])){
                 int tmp = p[i];
                 p[i] = p[j];
                 p[j] = tmp;
                 tmp = t[i];
                 t[i] = t[j];
                 t[j] = tmp;
             }
         }

        int i = k - 1;
//      System.out.println(i+" "+p[i]);
        while (i > 0 && p[i] == p[i - 1] && t[i] == t[i - 1]) i--;
    //  System.out.println(i);
        int j = 0;
        while (i < n - 1 && p[i] == p[i + 1] && t[i] == t[i + 1]) {
            i++;
            j++;
        }
//      System.out.println(i);
        System.out.println(j + 1);

    }
}