F - MaratonIME educates

F - MaratonIME educates

 Gym - 101375F 

USP has many lunch options between all the uni cafeterias and the restaurants inside the campus. An option that is usually chosen by MaratonIME seniors is the restaurant in the School of Education, for its good prices and free jelly.

The seniors have years of experience weighting on their shoulders, and therefore have tired legs. So they choose to go to the restaurant by car. Trying to save gas, the seniors always minimize the number of cars necessary to take everyone to the restaurant.

The seniors asked you to help them solve their problems. This morning, n cars with seniors arrived in the university, and all of them want to go to the restaurant. Each car holds up to 5 people. What is the minimum number of cars necessary to take everyone to the restaurant to "educate"?

Input

On the first line, an integer n, the number of cars. On the second line, n integers a1, ..., an, how many people arrived in each car.

Limits

  • 1 ≤ n ≤ 105.
  • 1 ≤ ai ≤ 5, for all i.

Output

Print a single integer, the minimum number of cars needed to take everyone to the restaurant.

Examples

Input

3
3 4 5

Output

3

Input

6
1 2 3 4 4 1

Output

3

这道题真的。。。。。怎么说呢,,,在这真的是跟队友鞠躬道歉了,看完这道题,我以为人数是不可以拆开的,和队友题意分析了一下,队友就去做了,怎么做都不对,但是看到AC的人数也太多了。。忽然另一个队友说直接除以五,交一下,我还强调肯定不是(捂脸)几分钟敲完,交上AC了(emmmm真香),恩,,,,我大概就是那个猪队友了。。。。。QAQ

题例数据     2 3 1 2 4 4 4   应该输出4

我当时的想法    2 3 1 2 4 4 4   应该输出5,那个2不能拆补到两个4上。。。(跪了)


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i,a[100001];
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    int s=0,m=0;
    for(i=0;i<n;i++)
        s+=a[i];
    if(s%5==0)
        m=s/5;
    else
        m=s/5+1;
    printf("%d\n",m);
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值