原题链接:http://codeforces.com/contest/991/problem/B

Getting an A

Translator’s note: in Russia’s most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.

The term is coming to an end and students start thinking about their grades. Today, a professor told his students that the grades for his course would be given out automatically — he would calculate the simple average (arithmetic mean) of all grades given out for lab works this term and round to the nearest integer. The rounding would be done in favour of the student — 4.54.54.5 would be rounded up to 55 5 (as in example 3), but 4.4" role="presentation" style="position: relative;">4.44.44.4 would be rounded down to 444.

This does not bode well for Vasya who didn’t think those lab works would influence anything, so he may receive a grade worse than 5" role="presentation" style="position: relative;">555 (maybe even the dreaded 222). However, the professor allowed him to redo some of his works of Vasya’s choosing to increase his average grade. Vasya wants to redo as as few lab works as possible in order to get 5" role="presentation" style="position: relative;">555 for the course. Of course, Vasya will get 555 for the lab works he chooses to redo.

Help Vasya — calculate the minimum amount of lab works Vasya has to redo.

Input

The first line contains a single integer n" role="presentation" style="position: relative;">nnn — the number of Vasya’s grades (1≤n≤100)(1≤n≤100)(1≤n≤100).

The second line contains nnn integers from 2to5" role="presentation" style="position: relative;">2to52to52 to 5 — Vasya’s grades for his lab works.

Output

Output a single integer — the minimum amount of lab works that Vasya has to redo. It can be shown that Vasya can always redo enough lab works to get a 555.

Examples
input

3
4 4 4

output

2

input

4
5 4 5 5

output

0

input

4
5 3 3 5

output

1

Note

In the first sample, it is enough to redo two lab works to make two 4" role="presentation" style="position: relative;">444s into 555s.

In the second sample, Vasya’s average is already 4.75" role="presentation" style="position: relative;">4.754.754.75 so he doesn’t have to redo anything to get a 555.

In the second sample Vasya has to redo one lab work to get rid of one of the 3" role="presentation" style="position: relative;">333s, that will make the average exactly 4.54.54.5 so the final grade would be 555.

题解

排一遍序,从小到大填5" role="presentation" style="position: relative;">555。

代码
#include<bits/stdc++.h>
using namespace std;
int a[105],sum,n;
void in(){scanf("%d",&n);for(int i=1;i<=n;++i)scanf("%d",&a[i]),sum+=a[i];}
void ac()
{sort(a+1,a+1+n);for(int i=0;i<=n;++i,sum=sum-a[i]+5)if(sum>=4.5*n)printf("%d",i),exit(0);
}
int main(){in();ac();}

最新文章

  1. 是否存在分布式的【大泥球】?
  2. 使用rar备份mysql_用RAR备份源代码_用WSH备份数据库
  3. 后端返回html标签到前端,后端返回的HTML代码字符串怎么能自动渲染到前端页面...
  4. 机电传动控制第二周学习笔记
  5. ZYAR20A 亚克力2驱 蓝牙 298寻迹避障机器人 —— 小车超声波避障实验(无舵机)
  6. css之hover改变子元素和其他元素样式
  7. 面向对象(静态成员内部类的调用)
  8. 图形基本变换c语言代码,图形变换-C语言课程设计.doc
  9. Maven包装过程中跳过测试
  10. INTERSPEECH2020 语音情感分析论文之我见
  11. Java进阶03 IO基础
  12. 特征选择-相关系数法F检验
  13. 把常用网站固定在任务栏
  14. box-sizing属性介绍
  15. Windows上配置iScsi发起程序,显示“CHAP密码不符合标准”
  16. 基于51单片机的带方位指示的自行车码表proteus仿真原理图PCB
  17. 记录一下Alphapose安装过程
  18. STM32控制步进电机运三种方式控制源码详解:主从定时器+编码器闭环+GPIO模拟(基于【TB6600】【DRV8825】驱动器)
  19. 苹果七绕过基带激活2020_【快讯:苹果135亿的基带订单,高通疑有诈直接拒绝了;网传索尼移动考虑退出东南亚手机市场;黑客成功获取iPhone XS 权限】...
  20. 两种方法配置yum仓库

热门文章

  1. mysql卸载注意问题_mysql卸载注意事项
  2. 服务器lsass占用内存_服务器内存跑满是什么原因造成的呢?
  3. 64位Win7下安装Oracle11gr2以及PL/sql(32位)安装
  4. 试验设计与matlab数据分析 下载,试验设计与MATLAB数据分析
  5. Windows安装zookeeper和kafka
  6. get() got an unexpected keyword argument
  7. C#编程(二十三)----------实现继承
  8. smalot-bootstrap-datetimepicker 使用心得
  9. ASP.NET 创建网站地图
  10. 有界、无界队列对ThreadPoolExcutor执行的影响