Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Taxi

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputAfter the lessons *n* groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the *i*-th group consists of *s*_{i} friends (1 ≤ *s*_{i} ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum number of cars will the children need if all members of each group should ride in the same taxi (but one taxi can take more than one group)?

Input

The first line contains integer *n* (1 ≤ *n* ≤ 10^{5}) — the number of groups of schoolchildren. The second line contains a sequence of integers *s*_{1}, *s*_{2}, ..., *s*_{n} (1 ≤ *s*_{i} ≤ 4). The integers are separated by a space, *s*_{i} is the number of children in the *i*-th group.

Output

Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.

Examples

Input

5

1 2 4 3 3

Output

4

Input

8

2 3 4 4 2 1 3 1

Output

5

Note

In the first test we can sort the children into four cars like this:

- the third group (consisting of four children),
- the fourth group (consisting of three children),
- the fifth group (consisting of three children),
- the first and the second group (consisting of one and two children, correspondingly).

There are other ways to sort the groups into four cars.

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/23/2019 12:07:53 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|