You have a laser with P amount of energy in it. You are playing a game where you have to use the laser to destroy some crystals, each with some health of their own. Initially, you have 0 points.
Each crystal has an associated health. The health of the ith crystal is given by health[i]. You can perform one of the two actions:
- 
At the cost of health[i] energy, you can destroy the ith crystal and gain 1 point. You can only perform this action if your laser has atleast health[i] energy in it.
- 
At the cost of 1 point, you can destroy the ith crystal and refuel the laser's energy by an amount equal to health[i]. This action can only be performed if you have atleast one point.
Note: Each crystal can only be destroyed once.
Determine the maximum number of points you can obtain by destroying any number of crystals and performing either action as you wish.

-----Input:-----
- First line will contain n, number of crystals. 
- Second line will contain space separated integers, health of each crystal.
- Third line will contain an integer P, initial energy of the laser.

-----Output:-----
Print the largest number of points we can have after destroying any number of crystals.

-----Constraints-----
- health.length <= 1000
- 0 <= health[i] < 10000
- 0 <= P < 10000

-----Subtasks-----
- 40 points : 1 <= health.length <= 100
- 60 points : health.length > 100

-----Sample Input 1:-----
1
200
100

-----Sample Output 1:-----
0

-----Explanation:-----
The laser initially has only 100 energy. Since the only crystal requires 200 energy to destroy, we cannot perform any action here, and the game ends. The number of points is zero.

-----Sample Input 2:-----
2
100 200
150

-----Sample Output 2:-----
1

-----Explanation:-----
The laser has 150 energy. We can consume 100 energy and destroy the first crystal and gain 1 point. The remaining energy is 50, which is not enough to destroy the other crystal. We end the game here as we have the maximum possible points attainable.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from sys import *\ninput=stdin.readline\nn=int(input())\nl=list(map(int,input().split()))\nl.sort()\np=int(input())\nc=0\ni=0\nwhile(i<n):\n    if(l[i]<=p):\n        c=c+1\n        p=p-l[i]\n        i=i+1\n    else:\n        if(c>0):\n            if(p+l[n-1]>=l[i]):\n                p=p+l[n-1]-l[i]\n                n=n-1\n                i=i+1\n        else:\n            break\nprint(c)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 19855