Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

PIZZAS - Pizza (challenge)

Abotrika is having a party because his team won the african cup so he is inviting his friends to eat some pizza. Unfortunately, Abotrika's friends can't eat an entire pizza but all of them know exactly how much pizza they can eat and insist on getting the exact amount of pizza but Abotrika eats one complete pizza and all of them wants his amount of pizza in one slice.

Their requests break down to three different pizza slices-either one quarter or a half or three quarters of pizza. Write a program that will help Abotrika to find out what is the minimal number of pizzas he has to order so that everyone gets exact amount of pizza they want.

Input

First line contains an integer N (0<=N<=10,000), number of friends. In each of next N lines there is amount of pizza that each of Abotrika's friends wants to eat, that is the fraction 1/4, 1/2 or 3/4.

Output

In the first and only line you should write the minimal number of pizzas Abotrika has order.

Don't forget to order one complete pizza for Abotrika.

Examples

Input:
3
1/2
3/4
3/4
Output: 4

Input:
5
1/2
3/4
1/2
1/4
1/4
Output:
4

Added by:Piotr Ką…kol
Date:2010-08-19
Time limit:5.039s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC SCM qobi VB.NET
Resource:Copy of Mohamed Maher's task EGYPIZZA.

hide comments
2013-06-22 12:30:07 Jander
@pardeep - Everyone wants their portion of pizza to be a single piece, ie 3/4 must be one single piece, and cannot be 1/4 + 1/2.

Therefore for the first test case there have to be 4 pizzas = 1 (Abotrika's) + 2 (for the 3/4s) + 1 (for the 1/2). There will of course then be spare pieces :-)
2013-06-21 10:07:57 pardeep kumar
how the o/p of first test case is 4.Please explain.
2010-08-25 15:21:23 Wendel Scardua
I guess I should buy some glasses :)
Sorry for any inconvenience
2010-08-25 09:31:08 Piotr KÄ…kol
They aren't. ;-)
$p14-=$p34 if $p34>=$p14; - WA
$p14-=$p34; - AC

Last edit: 2010-08-25 09:33:06
2010-08-25 01:06:07 Wendel Scardua
Ok, that was weird. 3949253 gives 21, but the next submit, 3950501, gives 18 and still got WA. After that, I posted this question. Now, I tried submitting this last version again ( 3960192 ) and it got AC. I just checked, 3960192 and 3950501 are identical.
2010-08-22 20:33:33 Piotr KÄ…kol
For test with 10 "1/2"'s, 10 "3/4"'s and 17 "1/4"'s the answer is 18 while Your program print 21. ;-)
2010-08-22 15:06:01 Wendel Scardua
I don't get why I got WA. I saw the comments on EGYPIZZA (and yes, the code gets AC there), but I tried all kinds of tests - even those on your comment there.

4
1/4
1/4
1/4
1/4
results 2

and

3
1/4
1/2
1/4
results 2 too.

I think I'm missing something, but I can't see what it is...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.