package main

import (
  "fmt"
  "os"
  "bufio"
  "log"
  "sort"
)

func fastGetInt(b[]byte) int{
  neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n
	}
	return n
}

func solveFromFile() int{
    var num int
    file, err := os.Open(os.Args[1])
    if err != nil {
      log.Fatalf("failed opening file: %s", err)
    }
    scanner := bufio.NewScanner(file)
    scanner.Scan()
    num = fastGetInt(scanner.Bytes())

    var inlist []int
    scanner.Scan()
    byts := scanner.Bytes()
  //  fmt.Println(byts)
    tempnum:=0
    tempnum = num *2-1
    count :=0
    for x := 0; x < tempnum; x++ {
      if byts[x]>='0'&&byts[x]<='9' {
        //fmt.Println([]byte{byts[x],'a'})
        i:= fastGetInt([]byte{byts[x]})
        //fmt.Println(i)
        inlist = append(inlist,i)
        count += i
      }

    }

    defer file.Close()

    return solution(inlist,count)
}

//========== Implement Algorithm =======================
func solution(num []int,count int) int{
  tempCount := 0
  totNum := 0
  sort.Ints(num)
  for x := len(num)-1; x >= 0; x-- {
    if tempCount<= (count/2){
      tempCount+= num[x]
      totNum++
    }
  }
  return totNum
}

func main() {

//================== Variables used ====================
  var num, ret int
  var inlist []int
//======================================================

  if len(os.Args) >=2{
//============== Get return value from File ============
    ret = solveFromFile()

  }else{
//============== Get return value from STDIN ===========
    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    num = fastGetInt(scanner.Bytes())
    scanner.Scan()
    byts := scanner.Bytes()
    count:= 0
    for x := 0; x < num; x=x+2 {
      i:= fastGetInt(byts[x:x+1])
      inlist = append(inlist,i)
      count += i
    }
    fmt.Println()
    ret = solution(inlist,count)
  }

//================== OUTPUT ============================
  fmt.Println(ret)
}


package main

import (
  "fmt"
  "os"
  "bufio"
  "log"
  "sort"
)

func fastGetInt(b[]byte) int{
  neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n
	}
	return n
}

func solveFromFile() int{
    var num int
    file, err := os.Open(os.Args[1])
    if err != nil {
      log.Fatalf("failed opening file: %s", err)
    }
    scanner := bufio.NewScanner(file)
    scanner.Scan()
    num = fastGetInt(scanner.Bytes())

    var inlist []int
    scanner.Scan()
    byts := scanner.Bytes()
  //  fmt.Println(byts)
    tempnum:=0
    tempnum = num *2-1
    count :=0
    for x := 0; x < tempnum; x++ {
      if byts[x]>='0'&&byts[x]<='9' {
        //fmt.Println([]byte{byts[x],'a'})
        i:= fastGetInt([]byte{byts[x]})
        //fmt.Println(i)
        inlist = append(inlist,i)
        count += i
      }

    }

    defer file.Close()

    return solution(inlist,count)
}

//========== Implement Algorithm =======================
func solution(num []int,count int) int{
  tempCount := 0
  totNum := 0
  sort.Ints(num)
  for x := len(num)-1; x >= 0; x-- {
    if tempCount<= (count/2){
      tempCount+= num[x]
      totNum++
    }
  }
  return totNum
}

func main() {

//================== Variables used ====================
  var num, ret int
  var inlist []int
//======================================================

  if len(os.Args) >=2{
//============== Get return value from File ============
    ret = solveFromFile()

  }else{
//============== Get return value from STDIN ===========
    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    num = fastGetInt(scanner.Bytes())
    scanner.Scan()
    byts := scanner.Bytes()
    count:= 0
    tempnum = num *2-1
    for x := 0; x < tempnum; x=x+2 {
      i:= fastGetInt(byts[x:x+1])
      inlist = append(inlist,i)
      count += i
    }
    ret = solution(inlist,count)
  }

//================== OUTPUT ============================
  fmt.Println(ret)
}


package main

import (
  "fmt"
  "os"
  "bufio"
  "log"
  "sort"
)

func fastGetInt(b[]byte) int{
  neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n
	}
	return n
}

func solveFromFile() int{
    var num int
    file, err := os.Open(os.Args[1])
    if err != nil {
      log.Fatalf("failed opening file: %s", err)
    }
    scanner := bufio.NewScanner(file)
    scanner.Scan()
    num = fastGetInt(scanner.Bytes())

    var inlist []int
    scanner.Scan()
    byts := scanner.Bytes()
  //  fmt.Println(byts)
    tempnum:=0
    tempnum = num *2-1
    count :=0
    for x := 0; x < tempnum; x++ {
      if byts[x]>='0'&&byts[x]<='9' {
        //fmt.Println([]byte{byts[x],'a'})
        i:= fastGetInt([]byte{byts[x]})
        //fmt.Println(i)
        inlist = append(inlist,i)
        count += i
      }

    }

    defer file.Close()

    return solution(inlist,count)
}

//========== Implement Algorithm =======================
func solution(num []int,count int) int{
  tempCount := 0
  totNum := 0
  sort.Ints(num)
  for x := len(num)-1; x >= 0; x-- {
    if tempCount<= (count/2){
      tempCount+= num[x]
      totNum++
    }
  }
  return totNum
}

func main() {

//================== Variables used ====================
  var num, ret int
  var inlist []int
//======================================================

  if len(os.Args) >=2{
//============== Get return value from File ============
    ret = solveFromFile()

  }else{
//============== Get return value from STDIN ===========
    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    num = fastGetInt(scanner.Bytes())
    scanner.Scan()
    byts := scanner.Bytes()
    count:= 0
    tempnum := num *2-1
    for x := 0; x < tempnum; x=x+2 {
      i:= fastGetInt(byts[x:x+1])
      inlist = append(inlist,i)
      count += i
    }
    ret = solution(inlist,count)
  }

//================== OUTPUT ============================
  fmt.Println(ret)
}


package main

import ("fmt";
		"sort")

type set map[int]bool
type long int64

func main(){
	var n, sum int
	scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++{
		scan(&a[i])
		sum += a[i]
	}
	sort.Slice(a, func(i, j int)bool{return a[i] > a[j]})
	pref := 0
	for i := 0; i < n; i++{
		pref += a[i]
		if pref * 2 > sum{
			sout(i + 1)
			return
		}
	}
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k)
	}
	fmt.Println()
}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	var sum = 0
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
		sum += arr[i]
	}
	for i := 0; i < n; i++ {
		for j := 0; j < n-i-1; j++ {
			if arr[j] < arr[j+1] {
				temp := arr[j]
				arr[j] = arr[j+1]
				arr[j+1] = temp
			}
		}
	}
	tempSum := 0
	count := 0
	for tempSum < sum/2+1 {

		tempSum += arr[count]
		count++
	}
	fmt.Print(count)
}


package main

import (
	"fmt"
	"sort"
)

func tryTake(n int, coins []int) bool {
	var sum1, sum2 int
	for i, val := range coins {
		if i < n {
			sum1 += val
		} else {
			sum2 += val
		}
	}

	return sum1 > sum2
}

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	coins := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &coins[i])
	}
	sort.Ints(coins)
	sort.Sort(sort.Reverse(sort.IntSlice(coins)))

	take := 1
	for !tryTake(take, coins) {
		take++
	}

	fmt.Println(take)
}


package main
import (
    "fmt"
    "sort"
)

func main() {
    var i,n,tmp int
    var vals[] int
    fmt.Scan(&n)
    sum:=0
    for i=0;i<n;i++ {
    	fmt.Scan(&tmp)
    	vals=append(vals,tmp)
    	sum+=tmp
    }
    sort.Sort(sort.Reverse(sort.IntSlice(vals)))
    tmp=0
    for i=0;i<n;i++ {
    	tmp+=vals[i]
    	if tmp>sum/2 {
    		break
    	}
    }
    fmt.Println(i+1)
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
)

const INF  = 1000000001

type Pair struct {
	first, second int
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] > arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func solution(reader io.Reader, writer io.Writer) {
	var n, s, s1 int
	fmt.Fscanf(reader, "%d\n", &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
		s += a[i]
	}

	a = sort(a)

	for i := 0; i < n; i++ {
		s1 += a[i]
		if s1 * 2 > s {
			fmt.Fprintf(writer, "%d\n", i + 1)
			return
		}
	}
	fmt.Fprintf(writer, "%d\n", n)
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var numberOfCoin int
	fmt.Scan(&numberOfCoin)

	coins := []int{}

	for i := 0; i < numberOfCoin; i++ {
		var coinValue int
		fmt.Scan(&coinValue)
		coins = append(coins, coinValue)
	}

	sort.Ints(coins)
	coins = reverse(coins)
	tmpCoins := coins

	value := 0
	count := 0

	for i, v := range coins {
		value += v
		count++
		tmpCoins = coins[i+1 : len(coins)]
		if value > sumCoinsValue(tmpCoins) {
			break
		}
	}

	fmt.Println(count)

}

func reverse(coins []int) (reversedCoins []int) {
	for i := len(coins) - 1; i >= 0; i-- {
		reversedCoins = append(reversedCoins, coins[i])
	}
	return
}

func sumCoinsValue(coins []int) (value int) {
	value = 0
	for _, v := range coins {
		value += v
	}
	return
}


package main

import "fmt"

func main() {
    var n int
    var a [105]int
    total := 0
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
        total += a[i]
    }
    for i := n-1; i > 0; i-- {
        k := i
        for j := 0; j < i; j++ {
            if a[j] < a[k] { k = j }
        }
        a[k], a[i] = a[i], a[k]
    }
    cnt := 0
    for i := 0; i < n; i++ {
        cnt += a[i]
        total -= a[i]
        if cnt > total {
            fmt.Println(i+1)
            break
        }
    }
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// https://codeforces.com/problemset/problem/160/A
// A. Twins
// time limit per test
// 2 seconds
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like.

// Now let's imagine a typical morning in your family. You haven't woken up yet, and Mom is already going to work. She has been so hasty that she has nearly forgotten to leave the two of her darling children some money to buy lunches in the school cafeteria. She fished in the purse and found some number of coins, or to be exact, n coins of arbitrary values a1, a2, ..., an. But as Mom was running out of time, she didn't split the coins for you two. So she scribbled a note asking you to split the money equally.

// As you woke up, you found Mom's coins and read her note. "But why split the money equally?" — you thought. After all, your twin is sleeping and he won't know anything. So you decided to act like that: pick for yourself some subset of coins so that the sum of values of your coins is strictly larger than the sum of values of the remaining coins that your twin will have. However, you correctly thought that if you take too many coins, the twin will suspect the deception. So, you've decided to stick to the following strategy to avoid suspicions: you take the minimum number of coins, whose sum of values is strictly more than the sum of values of the remaining coins. On this basis, determine what minimum number of coins you need to take to divide them in the described manner.
// Input

// The first line contains integer n (1 ≤ n ≤ 100) — the number of coins. The second line contains a sequence of n integers a1, a2, ..., an (1 ≤ ai ≤ 100) — the coins' values. All numbers are separated with spaces.
// Output

// In the single line print the single number — the minimum needed number of coins.

func main() {
	bufStdin := bufio.NewReader(os.Stdin)

	var n int
	_, _ = fmt.Fscan(bufStdin, &n)

	coins := make([]int, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscan(bufStdin, &coins[i])
	}

	sort.Ints(coins)

	var leftSum int
	for i := 0; i < len(coins)-1; i++ {
		leftSum += coins[i]
	}

	rightSum := coins[len(coins)-1]

	nCoins := 1

	for rightSum <= leftSum {
		exchange := coins[len(coins)-nCoins-1]

		leftSum -= exchange
		rightSum += exchange

		nCoins++
	}

	_, _ = fmt.Print(nCoins)

}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		fmt.Printf("%d: %d ", i, a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			i = i + 1
			fmt.Printf("all=%d res=%d i=%d\n", all, res, i)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			i = i + 1
			fmt.Printf("%d\n", i)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			fmt.Println(i + 1)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			i = i + 1
			fmt.Printf("all=%d res=%d i=%d\n", all, res, i)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		//fmt.Printf("%d: %d ", i, a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			i = i + 1
			//fmt.Printf("all=%d res=%d i=%d\n", all, res, i)
			fmt.Println(i)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		fmt.Printf("%d: %d ", i, a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			i = i + 1
			fmt.Printf("all=%d res=%d i=%d\n", all, res, i)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	//a := [4]int {}
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)

	for {
		res += a[i]
		if res > (all - res) {
			fmt.Println(i + 1)
			break
		} else {
			i++
		}
	}
}


package main

import (
	"fmt"
)

func Qsort(a []int, l int, r int) (err error) {
	x, i, j:= a[l], l, r
	for i < j {
		for (i < j) && (a[j] <= x) {
			j--
		}
		a[i] = a[j]
		for (i < j) && (a[i] >= x) {
			i++
		}
		a[j] = a[i]
	}
	a[i] = x
	if l < i-1 {
		Qsort(a, l, i-1)
	}
	if j+1 < r {
		Qsort(a, j+1, r)
	}
	return nil
}

//func vent(a *[4]int) (err error) {
//	(*a)[0] = 555
//	return nil
//}

func main() {
	var n, all, res, i int

	fmt.Scanf("%d", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		all += a[i]
	}
	Qsort(a, 0, len(a) - 1)
	for {
		res += a[i]
		if res > (all - res) {
			fmt.Printf("%d\n", i + 1)
			break
		} else {
			i++
		}
	}
}


package main

// https://codeforces.com/problemset/problem/160/A

import (
	"fmt"
	"sort"
)

func task_solution(a []int) (ans int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	sum := 0
	for _, e := range a {
		sum += e
	}
	for value := 0; ans < len(a) && (value <= sum-value); ans += 1 {
		value += a[ans]
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	in := []int{}
	for i := 0; i < n; i += 1 {
		var a int
		if _, err := fmt.Scan(&a); err != nil {
			panic(err)
		}
		in = append(in, a)
	}

	fmt.Println(task_solution(in))
}


package main

import (
	"fmt"
	"sort"
)

func task_solution(a []int) (ans int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	sum := 0
	for _, e := range a {
		sum += e
	}
	for value := 0; ans < len(a) && (value <= sum-value); ans += 1 {
		value += a[ans]
	}
	return ans
}

func main() {
	var n int
	_, err := fmt.Scan(&n)
	if err != nil {
		panic(err)
	}
	in := []int{}
	for i := 0; i < n; i += 1 {
		var a int
		_, err := fmt.Scan(&a)
		if err != nil {
			panic(err)
		}
		in = append(in, a)
	}

	fmt.Println(task_solution(in))
}


// Author: sighduck
// URL: https://codeforces.com/problemset/problem/160/A

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Solve(n int, a []int) int {
	sort.Ints(a)
	sum := 0
	for _, elem := range a {
		sum += elem
	}
	minSum := 0
	minCount := 0
	for i := n - 1; i >= 0; i-- {
		minSum += a[i]
		minCount += 1
		if minSum > sum-minSum {
			return minCount
		}
	}
	return minCount
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}
	fmt.Fscanf(reader, "\n")

	fmt.Fprintf(writer, "%d\n", Solve(n, a))
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, i int
	fmt.Scanln(&n)

	coins := make([]int, n)
	sum := 0
	for i = 0; i < n; i++ {
		fmt.Scan(&coins[i])
		sum += coins[i]
	}

	average := sum / 2
	sum = 0
	sort.Sort(sort.Reverse(sort.IntSlice(coins)))
	for i, value := range coins {
		sum += value
		if sum > average {
			fmt.Println(i + 1)
			break
		}
	}
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a = make([]int, n)
	var sum = 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		sum += a[i]
	}
	sum >>= 1
	sort.Ints(a)
	var ans = 0
	for i := len(a) - 1; i >= 0; i-- {
		sum -= a[i]
		ans++
		if sum < 0 {
			break
		}
	}
	fmt.Println(ans)
}


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = array_sum($b) / 2;
rsort($b);
$d = 0;
$e = 0;
for($x = 0; $x < count($b); $x++)
{
    $d += $b[$x];
    if($d > $c)
    {
        $e++;
        break;
    }
    else
    {
        $e++;
    }
}
print $e;
?>


<?php
	$n=trim(fgets(STDIN));
	$m=explode(" ",trim(fgets(STDIN)));
	sort($m);
	$t=array_sum($m);
	for($i=count($m)-1;$i>=0;$i--){
	    $c+=$m[$i];
	    $x++;
	    if($c > $t-$c){echo $x;break;}
	}


<?php
	$n = fgets(STDIN);
	$var = explode(' ',fgets(STDIN));
    $sub = 0; $x = 0;
	rsort($var);
	$sum = array_sum($var);
	foreach ($var as $val) {
		$sub += $val;
		$x++;
		if($sub > ( $sum - $sub )){
			echo $x;
			break;
		}
	}


<?php
	$n = fgets(STDIN);
	$var = explode(' ',$fgets(STDIN));
    $sub = 0; $x = 0;
	rsort($var);
	$sum = array_sum($var);
	foreach ($var as $val) {
		$sub += $val;
		$x++;
		if($sub > $sum-$sub){
			echo $x;
			break;
		}
	}


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	rsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = 0;
	$c = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum += $inp_arr[$i];
		$c++;
		if ($temp_sum > $sum - $temp_sum) break;
	}
	printf("%d", $c);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = $sum;
	$pos = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum -= $inp_arr[$i];
		$pos = $i;
		if ($temp_sum < (int)$sum / 2) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = 0;
	$pos = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum += $inp_arr[$i];
		$pos = $i;
		if ($temp_sum > $sum - $temp_sum) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = $sum;
	$pos = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum += $inp_arr[$i];
		$pos = $i;
		if ($temp_sum > $sum - $temp_sum) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = 0;
	$c = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum += $inp_arr[$i];;
		$c++;
		if ($temp_sum > $sum - $temp_sum) break;
	}
	printf("%d", $c);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	//$Scanner = new Scanner("php://stdin");
	$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_pos = 0;
	$temp_sum = $sum;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum -= $inp_arr[$i];
		$pos = $i;
		if ($temp_sum < (int)$sum / 2) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = $sum;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum -= $inp_arr[$i];
		$pos = $i;
		if ($temp_sum < (int)$sum / 2) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	arsort($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = $sum;
	$pos = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum -= $inp_arr[$i];
		$pos = $i;
		if ($temp_sum < $sum - $temp_sum) break;
	}
	printf("%d", $pos + 1);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php
error_reporting(0);

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$inp_n = (int)$Scanner->Scan();
	for ($i = 0; $i < $inp_n; $i++) {
		$inp_arr[] = (int)$Scanner->Scan();
	}
	rsort()($inp_arr);
	$sum = array_sum($inp_arr);
	$temp_sum = 0;
	$c = 0;
	for ($i = 0; $i < $inp_n; $i++) {
		$temp_sum += $inp_arr[$i];
		$c++;
		if ($temp_sum > $sum - $temp_sum) break;
	}
	printf("%d", $c);
	$Scanner->close();
}

ob_end_clean();
solve();

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link or ''php://stdin' err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		//err $c_row = array("\n", "\r", "\r\n");
		$c_row = array("\r\n", "\r", "\n");
		$contents = str_replace($c_row, " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	function Scan(){
		$x = $this->Id;
		$sc = $this->Scanners[$x];
		$this->Id = ++$x;
		return $sc;
	}

	function close(){
		fclose($this->Stream);
	}
}

/*
====begin=====

//input    $inp_ or upper
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $^Upper

====end=======

===== class begin =====

//error_reporting(0);
//$Scanner = new Scanner("php://stdin");
//ref "#109_div2_B_1230942 laurenceHR"
class LineScanner{
	private $Stream;
	private $Scanners = array();
	private $LineIds_Of_ScanIds= array();
	private $LinesScanners = array();
	private $LastScanIds_Of_LineIds = array();
	private $Scan_number = 0;
	private $Scanline_number = 0;

	public function __construct($opend){
		if((!is_file($opend) && !is_link($opend)) && $opend !== "php://stdin"){
  			print("file or link err");
  			exit;
		}

		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);

		$temp_lines = explode("\n", $contents);
		$temp_linescanners = array();
		$temp_x = 0;
		$temp_y = 0;
		//--attention for initting of array--(these is not needed but for easily reading)//
		$ttemp_scanners = array();
		//$del = Array("\n","\r","\n\r");
		foreach ($temp_lines as $as_line) {
			if (strlen($as_line) === 0) {
				print("input err");
			}

			//$as_line = str_replace($del,'',$as_line);
			$temp_linescanners[] = $as_line;
			$ttemp_line_scanners = explode(" ", $as_line);
			//$ttemp_scanners = array();
			foreach ($ttemp_line_scanners as $as_sc) {
				$ttemp_scanners[] = $as_sc;
				$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;
				$temp_x++;
			}
			$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;
			$temp_y++;
		}
		$this->Scanners = $ttemp_scanners;
		$this->LinesScanners = $temp_linescanners;
	}

	function Scan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("scan err");
		}

		$sc = $this->Scanners[$x];
		//--attention for ++$x//
		//$this->Scan_number = $x++;
		$this->Scan_number = ++$x;
		$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];
		return $sc;
	}

	function LineScan(){
		$x = $this->Scan_number;
		$y = $this->Scanline_number;
		if ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {
			print("linescan err");
		}

		$lsc = $this->LinesScanners[$y];
		$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;
		$this->Scanline_number = $y + 1;
		return $lsc;
	}

	function close(){
		fclose($this->Stream);
	}
}

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}
===== class end ======

=== function begin ===

function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}

function num_printf($i){
	if (is_float($i)) {
		printf("%.0f", $i);
	}
	if (is_int($i)) {
		printf("%d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			$message .= "$value" . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

== function end ======
*/

?>


<?php

$numberOfConis = readline();
$coinsValue = readline();
$coinsArray = explode(" ",$coinsValue) ;
rsort($coinsArray) ;
$takenCoinsArray = array() ;
$flag = true ;

while($flag){
    $takenCoinsArray[] = array_shift($coinsArray) ;
    if(getArraySum($takenCoinsArray) > getArraySum($coinsArray)){
        $flag = false ;
    }
}

echo count($takenCoinsArray) ;

function getArraySum($array){
    $totalSum = 0 ;
    for($i = 0 ; $i < count($array) ; $i ++){
        $totalSum += $array[$i] ;
    }
    return $totalSum ;
}


<?php

    // 160 A

    //$handle = fopen('input.txt', "r");
    $handle = STDIN;

    // Ignore first line
    fgets($handle, 4096);

    $tokens = explode(" ", trim(fgets($handle, 4096)));

    sort($tokens);

    $total = 0;

    foreach($tokens as $val){

            $total += (int)$val;
    }

    $target = $total / 2;

    $coin_count = 0;
    $sum = 0;

    while($sum < $target){

            $coin_count++;
            $sum += (int)array_pop($tokens);
    }

    echo $coin_count;


<?php

    // 160 A

    //$handle = fopen('input.txt', "r");
    $handle = STDIN;

    // Ignore first line
    fgets($handle, 4096);

    $tokens = explode(" ", trim(fgets($handle, 4096)));

    sort($tokens);

    $total = 0;

    foreach($tokens as $val){

            $total += (int)$val;
    }

    $target = $total / 2;

    $coin_count = 0;
    $sum = 0;

    while($sum <= $target){

            $coin_count++;
            $sum += (int)array_pop($tokens);
    }

    echo $coin_count;


<?php
function cmp($a, $b)
{
    if ($a == $b) {
        return 0;
    }
    return ($a < $b) ? -1 : 1;
}
list($n)=explode(" ",trim(fgets(STDIN)));
$a=explode(" ",trim(fgets(STDIN)));
usort($a, "cmp");
for($i=0,$sum=0;$i<$n;$i++)
$sum+=$a[$i];
for($i--,$v=$a[$i];$i>=0;$i--)
if (2*$v>$sum) {print $n-$i;break;}
else $v+=$a[$i-1];
?>


var calendars=[
	[
		['9:00', '10:30'],['12:00', '13:00'],['16:00', '18:00']
	],
	[
		['10:00', '11:30'],['12:30', '14:30'],['14:30', '15:00']
	]
];

var bounds=[
	[
		['9:00', '20:00']
	],
	[
		['10:00', '18:30']
	]
];

var availableBlocks= [];

var duration=30;

//setting start and end of the day
var startDay = new Date();
startDay.setHours(0,0,0);
var endDay = new Date();
endDay.setHours(24,0,0);

var numOfCalendars = calendars.length;
var numOfBounds = bounds.length;

for (var i=0; i<numOfCalendars; i++) {
	findBetween(calendars[i]);
}

function findBetween(calendar) {
	var meetings = calendar.length;
	var block = [];
	for (var i=1; i<meetings; i++) {
		var end = convTime(calendar[i-1][1]);
		var start = convTime(calendar[i][0]);
		var num = numOfAvailableBlocks(end, start);
		for (var j=1; j<=num; j++) {
			var availDate = new Date(end);
			availDate.setMinutes(availDate.getMinutes() + duration);
			block.push([dateToHour(end), dateToHour(availDate)]);
			end.setMinutes(end.getMinutes() + duration);
		}
	}
	availableBlocks.push(block);
}

console.log(availableBlocks);

function convTime(timeString) {
	var time = new Date();
	var timeArr = timeString.split(":");
	time.setHours(timeArr[0], timeArr[1], 0);
	return time;
}

function numOfAvailableBlocks(date1, date2) {
	return Math.floor((date2-date1)/1000/60/30);
}

function dateToHour(date) {
	return date.getHours() + ":" + (date.getMinutes()<10?'0':'') + date.getMinutes();
}


<?php
fscanf(STDIN, "%d", $n);
$c = "";
for ($j=0; $j<$n; $j++) {
    $c .= "%d ";
}
$arr = fscanf(STDIN, $c);

$target = array_sum($arr) / 2;

$sum = 0;
$counter = 0;
for ($i=0; $i<$arr; $i++) {
	$sum += $arr[$i];
	$counter++;
	if ($sum > $target) {
		echo $counter;
		exit;
	}
}

?>


<?php
fscanf(STDIN, "%d", $n);
$c = "";
for ($j=0; $j<$n; $j++) {
    $c .= "%d ";
}
$arr = fscanf(STDIN, $c);
rsort($arr);

$target = array_sum($arr) / 2;

$sum = 0;
$counter = 0;
for ($i=0; $i<$arr; $i++) {
	$sum += $arr[$i];
	$counter++;
	if ($sum > $target) {
		echo $counter;
		exit;
	}
}

?>


<?php
while($s = fgets(STDIN))
{
    $input .= $s;
}

$input = explode("\r\n", $input);
$input = explode(" ", $input[1]);
$coins = array();

foreach($input as $i) $coins[] = (int)$i;
$sum = array_sum($coins);
$s = 0;
$c = 0;
rsort($coins);
foreach($coins as $coin)
{
    $s += $coin;
    $c++;
    if($s > ($sum-$s)) break;
}

echo $c;


<?php

while($s = fgets(STDIN)){
    $input .= $s;
}

$directory = '/';
$input = explode("\r\n", $input);
$s = $input[1];
/*/

$s = '2 1 2';

//*/
$m = array();

$s = explode(' ', $s);
foreach($s as $v) {
    $m[] = intval($v);
}

$total = array_sum($m);
if(($total % 2) == 0) {
    $need = ($total/2)+1;
} else {
    $need = ceil($total/2);
}

$mcount = 0;
$summ = 0;
rsort($m);
foreach ($m as $key => $value) {
    $mcount += 1;
    $summ += $value;
    if($summ >= $need) break;
}

echo $mcount;


<?php

while($s = fgets(STDIN)){
    $input .= $s;
}

$directory = '/';
$input = explode("\r\n", $input);
$s = $input[1];
/*/

$s = '2 1 2';

//*/
$m = array();

$s = explode(' ', $s);
foreach($s as $v) {
    $m[] = intval($v);
}

$total = array_sum($m);
if(($total % 2) == 0) {
    $need = ($total/2)+1;
} else {
    $need = ceil($total/2);
}

$mcount = 0;
$summ = 0;
rsort($m);
foreach ($m as $key => $value) {
    $mcount += 1;
    $summ += $value;
    if($summ > $need) break;
}

echo $mcount;


<?php
	$take = 0;
	$temp = 0;
	$left = 0;
	$i = 0;
	$coin_count = trim(fgets(STDIN));
	$coins = explode(" ",trim(fgets(STDIN)));
	$coins_sum=array_sum($coins);
	rsort($coins);
	$left = $coins_sum - $temp;
	while($coin_count > 0)
	{

		if($temp > $left)
			break;
		else
		{
			$temp = $temp + $coins[$i];
			$left = $left - $temp;
			$take++;
		}
		$i++;
		$coin_count--;
	}
	echo $take;
?>


<?php
	$take = 0;
	$temp = 0;
	$left = 0;
	$i = 0;
	$coin_count = trim(fgets(STDIN));
	$coins = explode(" ",trim(fgets(STDIN)));
	$coins_sum=array_sum($coins);
	rsort($coins);
	$left = $coins_sum - $temp;
	while($coin_count > 0)
	{

		if($temp > $left)
			break;
		else
		{
			$temp = $temp + $count[$i];
			$left = $left - $temp;
			$take++;
		}
		$i++;
	}
	echo $take;
?>


<?php
	$take = 0;
	$temp = 0;
	$left = 0;
	$i = 0;
	4 2 2 2 2
	12
	4 2 2 2 2
	12
	5
		0 > 12

	$coin_count = trim(fgets(STDIN));
	$coins = explode(" ",trim(fgets(STDIN)));
	$coins_sum=array_sum($coins);
	rsort($coins);
	$left = $coins_sum - $temp;
	while($coin_count > 0)
	{

		if($temp > $left)
			break;
		else
		{
			$temp = $temp + $coins[$i];
			$left = $coins_sum - $temp;
			$take++;
		}
		$i++;
		$coin_count--;
	}
	echo $take;
?>


<?php
	$take = 0;
	$temp = 0;
	$left = 0;
	$i = 0;
	$coin_count = trim(fgets(STDIN));
	$coins = explode(" ",trim(fgets(STDIN)));
	$coins_sum=array_sum($coins);
	rsort($coins);
	$left = $coins_sum - $temp;
	while($coin_count > 0)
	{

		if($temp > $left)
			break;
		else
		{
			$temp = $temp + $count[$i];
			$left = $left - $temp;
			$take++;
		}
		$i++;
		$coin_count--;
	}
	echo $take;
?>


<?php
	$take = 0;
	$temp = 0;
	$left = 0;
	$i = 0;

	$coin_count = trim(fgets(STDIN));
	$coins = explode(" ",trim(fgets(STDIN)));
	$coins_sum=array_sum($coins);
	rsort($coins);
	$left = $coins_sum - $temp;
	while($coin_count > 0)
	{

		if($temp > $left)
			break;
		else
		{
			$temp = $temp + $coins[$i];
			$left = $coins_sum - $temp;
			$take++;
		}
		$i++;
		$coin_count--;
	}
	echo $take;
?>


<?php
$n = trim(fgets(STDIN));

$InStr = trim(fgets(STDIN));
$Money = explode(' ', $InStr);

rsort($Money);

for($i = 0; $i < $n; $i++){
    $ar1 = array_slice($Money, 0, $i);
    $ar2 = array_slice($Money, $i);

    if(array_sum($ar1) > array_sum($ar2)){
        break;
    }
}

echo $i . "\r\n";
?>


<?php
while($s = fgets(STDIN)){
    $input[]= $s;
}
$count = $input[0];
$nums = explode(' ', $input[1]);
$summ = 0;
$result = 0;
$res = 0;

foreach($nums as $value) {
    $summ = $summ + $value;
}
rsort($nums);
foreach($nums as $value) {
    $result++;
    $res = $res + $value;
    if ($res > ($summ/2)) {
        echo $result;
        die();
    }
}
?>


<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$nums = explode(' ', $input[1]);

foreach($nums as $value) {
    $summ = $summ + $value;
}
rsort($nums);
foreach($nums as $value) {
    $result++;
    $res = $res + $value;
    if ($res > ($summ/2)) {
        echo $result;
        die();
    }
}
?>


<?php
while($s = fgets(STDIN)){
    $input[]= $s;
}
$count = $input[0];
$nums = explode(' ', $input[1]);

foreach($nums as $value) {
    $summ = $summ + $value;
}
rsort($nums);
foreach($nums as $value) {
    $result++;
    $res = $res + $value;
    if ($res > ($summ/2)) {
        echo $result;
        die();
    }
}
?>


<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function foo($a)
{
    rsort($a);

    $me = 0;
    $bro = array_sum($a);
    $i = 0;

    while ($me <= $bro && !empty($a)) {
        $me += $a[$i];
        $bro -= $a[$i];
        unset($a[$i]);
        $i++;
    }

    return $i;
}

$r = 0;

list($n) = fscanf($input, "%d\n");

$a = fscanf($input, trim(str_repeat("%d ", $n)));

$r = foo($a);

fwrite($output, $r);


<?php

$dir = fopen("php://stdin", 'r');
$input = stream_get_contents($dir);

$arr = explode(PHP_EOL, $input);
$numbers = explode(" ", $arr[1]);
sort($numbers);
$k=0; $sum=0;

do{
    $first = array_shift($numbers);
    $sum += (int)$first;
    $k++;
}
while($sum < array_sum($numbers));

echo $k;


<?php

$dir = fopen("php://stdin", 'r');
$input = stream_get_contents($dir);

$arr = explode(PHP_EOL, $input);
$numbers = explode(" ", $arr[1]);
rsort($numbers);
$k=0;
$sum=0;

do {
    $first = array_shift($numbers);
    $sum += (int) $first;
    $k++;
} while($sum <= array_sum($numbers));

echo $k;


<?php
fscanf(STDIN,"%s",$n);
$a = explode(" ", trim(fgets(STDIN)));
$out = [];
do {
  $out[] = takeMax($a);
} while(array_sum($a) >= array_sum($out));
echo count($out);

function takeMax(&$array) {
  $max = $array[0];
  $id = 0;
  for ($i = 0; $i < count($array); $i++)
    if ($max < $array[$i]) {
      $max = $array[$i];
      $id = $i;
    }
  unset($array[$id]);
  sort($array);
  return $max;
}


<?php
    $n = fgets(STDIN);
    $arr = explode(" ", fgets(STDIN));
    rsort($arr);
    $sum = 0; $count = 0; $all_sum = 0;
    for($i = 0; $i < $n; ++$i)
    {
        $all_sum += $arr[$i];
    }
    for($i = 0; $i < $n; ++$i)
    {
        $sum += $arr[$i];
        $count++;
        if($sum > $all_sum - $sum)
        {
            break;
        }
    }
    echo $count;
?>


<?php
    $n = fgets(STDIN);
    $arr = explode(" ", fgets(STDIN));
    sort($arr);
    $sum = 0; $count = 0; $all_sum = 0;
    for($i = 0; $i < $n; ++$i)
    {
        $all_sum += $arr[$i];
    }
    for($i = 0; $i < $n; ++$i)
    {
        $sum += $arr[$i];
        $count++;
        if($sum > $all_sum - $sum)
        {
            break;
        }
    }
    echo $count;
?>


<?php
    $n = trim(fgets(STDIN));
    $arr = explode(" ", trim(fgets(STDIN)));
    rsort($arr);
    $all_sum = array_sum($arr);
    for($i = 0; $i < $n; ++$i)
    {
        $sum += $arr[$i];
        $count++;
        if($sum > $all_sum - $sum)
        {
            echo $count;
            break;
        }
    }
?>


<?php
    $n = fgets(STDIN);
    $arr = explode(" ", fgets(STDIN));
    sort($arr);
    $sum = 0; $count = 0; $all_sum = 0;
    for($i = 0; $i < $n; ++$i)
    {
        $all_sum += $arr[$i];
    }
    for($i = 0; $i < $n; ++$i)
    {
        $sum += $arr[$i];
        $count++;
        if($sum >= $all_sum - $sum)
        {
            break;
        }
    }
    echo $count;
?>


<?php
    $n = fgets(STDIN);
    $arr = explode(" ", fgets(STDIN));
    rsort($arr);
    $all_sum = array_sum($arr);
    for($i = 0; $i < $n; ++$i)
    {
        $sum += $arr[$i];
        $count++;
        if($sum > $all_sum - $sum)
        {
            echo $count;
            break;
        }
    }
?>


<?php

$n = (int) readline();

$nums = array_map('intval', explode(' ', readline()));
$sum = 0;
foreach($nums as $num){
    $sum += $num;
}

rsort($nums);
$count = 0;
$tmp = 0;
for($i=0;$i<$n;$i++){
    $count++;
    $tmp += $nums[$i];
    if($tmp > ($sum/2)){
        break;
    }
}

echo $count;


<?php
$n = trim(fgets(STDIN));
$coin = explode(" ",trim(fgets(STDIN)));
rsort($coin);
$summ=0;
$average=0;
for ($i=0; $i<$n;$i++)
{
    $average+=$coin[$i];
}
$average=$average/2;
for ($i=0; $i<$n;$i++)
{
    $summ+=$coin[$i];
    if ($summ>$average)
    {
        echo $i+1;
        break;
    }
}


<?php

fscanf(STDIN, '%d/n', $number);
$twins = trim(fgets(STDIN));
$arr_twins = preg_split('/\s/', $twins, -1, PREG_SPLIT_NO_EMPTY);

$buf = 0;
for ($i = 0; $i < count($arr_twins)-1; $i++) {
    for ($j = 0; $j < count($arr_twins)-$i-1; $j++) {
        if ($arr_twins[$j] > $arr_twins[$j+1]) {
            $buf = $arr_twins[$j+1];
            $arr_twins[$j+1] = $arr_twins[$j];
            $arr_twins[$j] = $buf;
        }
    }
}
$sum1 = 0;
for ($i = 0; $i < count($arr_twins); $i++) {
    $sum1 = $sum1 + $arr_twins[$i];
}
$k = count($arr_twins)-1;
$ch = 0;
$sum2 = 0;
do {
    $sum1 = $sum1 - $arr_twins[$k];
    $sum2 = $sum2 + $arr_twins[$k];
    $k = $k-1;
    $ch = $ch + 1;
}
while ($sum2 <= $sum1);
print($ch);


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class CX6 {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=1;
        t=scan.nextInt();
        while(t-->0){
            int n0=scan.nextInt();
            int n1=scan.nextInt();
            int n2=scan.nextInt();
            StringBuilder ans=new StringBuilder();
            for (int i = 0; i <n0; i++) {
                ans.append("0");
            }
            if(n1>0){
                ans.append("01");
                n1--;
                while(n1>1){
                    n1-=2;
                    ans.append("01");
                }
            }else if(n0>0){
                ans.append("0");
            }
            for(int i=0;i<n2;i++){
                ans.append("1");
            }
            if(n1!=0){
                ans.append("0");
            }
            out.println(ans);
        }
        out.flush();
        out.close();
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.lang.management.*;
import static java.lang.Math.*;

@SuppressWarnings("unchecked")
public class P1352F {

  public void run() throws Exception {
    for (int t = nextInt(); t > 0; t--) {
      int n0 = nextInt(), n1 = nextInt(), n2 = nextInt(), n = n0 + n1 + n2 + 1, a [] = new int [n];
      for (int i = n - n2; i < n; a[i] = 1, i++);
      for (int i = n0, v = 0; i < (n - n2); a[i] = v, v ^= 1, i++);
      a[0] = ((n1 == 0) && (n0 == 0)) ? 1 : a[0];
      for (int i = 0; i < n; print(a[i]), i++);
      println();
    }
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P1352F().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
    long gct = 0, gcc = 0;
    for (GarbageCollectorMXBean garbageCollectorMXBean : ManagementFactory.getGarbageCollectorMXBeans()) {
      gct += garbageCollectorMXBean.getCollectionTime();
      gcc += garbageCollectorMXBean.getCollectionCount();
    }
    System.err.println("[GC time : " + gct + " ms, count = " + gcc + "]");
    System.err.println("[JIT time : " + ManagementFactory.getCompilationMXBean().getTotalCompilationTime() + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void printsp(int [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); }
  void printsp(long [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  boolean isPrime(int v) {
    if (v <= 1) { return false; }
    if (v <= 3) { return true; }
    if (((v & 1) == 0) || ((v % 3) == 0)) { return false; }
    for (int m = 5, n = (int)sqrt(v); m <= n; m += 6) { if (((v % m) == 0) || ((v % (m + 2)) == 0)) { return false; } }
    return true;
  }

  int [] rshuffle(int [] a) { // RANDOM shuffle
    Random r = new Random();
    for (int i = a.length - 1, j, t; i >= 0; j = r.nextInt(a.length), t = a[i], a[i] = a[j], a[j] = t, i--);
    return a;
  }

  int [] qshuffle(int [] a) { // QUICK shuffle
    int m = new Random().nextInt(10) + 2;
    for (int i = 0, n = a.length, j = m % n, t; i < n; t = a[i], a[i] = a[j], a[j] = t, i++, j = (i * m) % n);
    return a;
  }

  long [] shuffle(long [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      long t = a[i]; a[i] = a[j]; a[j] = t;
    }
    return a;
  }

  void shuffle(Object [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      Object t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  int [] sort(int [] a) {
    final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;
    int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];
    for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);
    for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);
    for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);
    int [] t = a; a = ta; ta = t;
    ai = new int [SIZE];
    for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);
    for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);
    for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);
    return ta;
  }

  void flush() {
    pw.flush();
  }

  void pause() {
    flush(); System.console().readLine();
  }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.lang.management.*;
import static java.lang.Math.*;

@SuppressWarnings("unchecked")
public class P1352F {

  boolean check(int [] a, int [] n) {
    for (int i = n[0] + n[1] + n[2] - 1; i >= 0; n[a[i] + a[i + 1]]--, i--);
    return ((n[0] | n[1] | n[2]) == 0);
  }

  public void run() throws Exception {
    for (int t = nextInt(); t > 0; t--) {
      int n0 = nextInt(), n1 = nextInt(), n2 = nextInt(), n = n0 + n1 + n2 + 1, a0 [] = new int [n], a1 [] = new int [n];

      if ((n1 == 0) && (n2 == 0)) {
        for (int i = 0; i < n; print("0"), i++);
        println();
        continue;
      }

      if ((n1 == 0) && (n0 == 0)) {
        for (int i = 0; i < n; print("1"), i++);
        println();
        continue;
      }

      if ((n0 == 0) && (n2 == 0)) {
        for (int i = 0, v = 0; i < n; print(v), v ^= 1, i++);
        println();
        continue;
      }

      for (int i = n - n2; i < n; a1[i] = 1, a0[i] = 1, i++);

      for (int i = n0, v = 0; i < (n - n2); a0[i] = v, v ^= 1, i++);
      for (int i = n0, v = 1; i < (n - n2); a1[i] = v, v ^= 1, i++);

      if (check(a0, new int [] { n0, n1, n2 })) {
        for (int i = 0; i < n; print(a0[i]), i++);
      } else {
        for (int i = 0; i < n; print(a1[i]), i++);
      }

      println();
    }
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P1352F().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
    long gct = 0, gcc = 0;
    for (GarbageCollectorMXBean garbageCollectorMXBean : ManagementFactory.getGarbageCollectorMXBeans()) {
      gct += garbageCollectorMXBean.getCollectionTime();
      gcc += garbageCollectorMXBean.getCollectionCount();
    }
    System.err.println("[GC time : " + gct + " ms, count = " + gcc + "]");
    System.err.println("[JIT time : " + ManagementFactory.getCompilationMXBean().getTotalCompilationTime() + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void printsp(int [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); }
  void printsp(long [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  boolean isPrime(int v) {
    if (v <= 1) { return false; }
    if (v <= 3) { return true; }
    if (((v & 1) == 0) || ((v % 3) == 0)) { return false; }
    for (int m = 5, n = (int)sqrt(v); m <= n; m += 6) { if (((v % m) == 0) || ((v % (m + 2)) == 0)) { return false; } }
    return true;
  }

  int [] rshuffle(int [] a) { // RANDOM shuffle
    Random r = new Random();
    for (int i = a.length - 1, j, t; i >= 0; j = r.nextInt(a.length), t = a[i], a[i] = a[j], a[j] = t, i--);
    return a;
  }

  int [] qshuffle(int [] a) { // QUICK shuffle
    int m = new Random().nextInt(10) + 2;
    for (int i = 0, n = a.length, j = m % n, t; i < n; t = a[i], a[i] = a[j], a[j] = t, i++, j = (i * m) % n);
    return a;
  }

  long [] shuffle(long [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      long t = a[i]; a[i] = a[j]; a[j] = t;
    }
    return a;
  }

  void shuffle(Object [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      Object t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  int [] sort(int [] a) {
    final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;
    int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];
    for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);
    for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);
    for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);
    int [] t = a; a = ta; ta = t;
    ai = new int [SIZE];
    for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);
    for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);
    for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);
    return ta;
  }

  void flush() {
    pw.flush();
  }

  void pause() {
    flush(); System.console().readLine();
  }
}