A. Bear and Game
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.

Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.

You know that there will be n interesting minutes t1, t2, ..., tn. Your task is to calculate for how many minutes Limak will watch the game.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes.

The second line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... tn ≤ 90), given in the increasing order.

Output

Print the number of minutes Limak will watch the game.

Examples
Input
3
7 20 88
Output
35
Input
9
16 20 30 40 50 60 70 80 90
Output
15
Input
9
15 20 30 40 50 60 70 80 90
Output
90
Note

In the first sample, minutes 21, 22, ..., 35 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.

In the second sample, the first 15 minutes are boring.

In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game.

我只能说刷水题异常带感。

 /**/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int last=,x,n;
int main(){
scanf("%d",&n);
while(n--){
scanf("%d",&x);
if(x-last>){
printf("%d\n",last+);
break;
}
if(!n){
printf("%d\n",min(x+,));
break;
}
last=x;
}
return ;
}

最新文章

  1. hibernate+mysql的连接池配置
  2. PHPMailer &lt; 5.2.18 - RCE EXP(Bash)
  3. 归档—监控ORACLE数据库告警日志
  4. php发送post请求到nodejs服务器
  5. LeetCode题目分类
  6. RegExp子模式- &quot;()&quot;
  7. 半透命opacity:(0-1),对于IE6版本不支持需要用filter:alpha(opacity=0-100)
  8. Jmeter之性能测试插件PerfMon Metrics Collector监听器,实时监听服务器资源(十四)
  9. clique
  10. Python中如何自定义一个计时器
  11. window 8.1 + python 3.6 + chrome 59 + selenium 3.4 环境配置
  12. Android Studio配置统一管理依赖版本号引用
  13. AI-2.梯度下降算法
  14. linux终端文本编辑神器vi的使用
  15. SQL 自定义存储过程报错
  16. 使用mockserver来进行http接口mock
  17. cocos2d-js Shader系列3:多重纹理 multiple textures multiple samplers
  18. vs2017 编译JRTPLIB
  19. android 用命令行打包生成 apk
  20. 常见的Shell

热门文章

  1. JZOJ 5849 d
  2. WPF实现QQ群文件列表动画(二)
  3. Android 有些机型hint不显示
  4. RF,GBDT,XGBoost,lightGBM的对比
  5. LoadRunner11的安装和使用及其注意点(测试系统是win7)
  6. mac攻略(九) -- ssh工具secureCRT
  7. Apache shiro学习总结
  8. 谋哥:App推广最有效的是自推广
  9. xss games20关小游戏附源代码
  10. 来自知乎的pthread_cond_wait为什么总是带着mutex