You run a stand where every item costs exactly 5. Customers arrive one at a time and each pays with a single bill worth 5, 10, or 20. You must give each customer back the correct change immediately, using only bills you have collected from earlier customers (you start with no cash).
Decide whether you can serve every customer in the given order.
Input format
Line 1: an integer n, the number of customers.
Line 2: n space-separated integers, each 5, 10, or 20 — the bill each customer pays with, in arrival order (present whenever n >= 1).
Output format
Print YES if you can give correct change to every customer in order, otherwise print NO.
Constraints
- 1 <= n <= 100000
- Each bill is one of 5, 10, 20.