CF272A.Dima and Friends

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.

To decide who exactly would clean the apartment, the friends want to play a counting-out game. First, all the guys stand in a circle, and then each of them shows some number of fingers on one hand (one to five), and then the boys count in a circle, starting from Dima, the number of people, respective to the total number of fingers shown. The person on who the countdown stops will clean the apartment.

For example, if Dima and one of his friends played hide and seek, and 77 fingers were shown during the counting-out, then Dima would clean the place. If there were 22 or say, 88 fingers shown, then his friend would clean the place.

Dima knows how many fingers each of his friends will show during the counting-out. Now he is interested in the number of ways to show some number of fingers on one hand (one to five), so that he did not have to clean the place. Help Dima.

输入格式

The first line contains integer nn (1<=n<=100)(1<=n<=100) — the number of Dima's friends. Dima himself isn't considered to be his own friend. The second line contains nn positive integers, not exceeding 55 , representing, how many fingers the Dima's friends will show.

The numbers in the lines are separated by a single space.

输出格式

In a single line print the answer to the problem.

输入输出样例

  • 输入#1

    1
    1
    

    输出#1

    3
    
  • 输入#2

    1
    2
    

    输出#2

    2
    
  • 输入#3

    2
    3 5
    

    输出#3

    3
    

说明/提示

In the first sample Dima can show 11 , 33 or 55 fingers. If Dima shows 33 fingers, then the counting-out will go like that: Dima, his friend, Dima, his friend.

In the second sample Dima can show 22 or 44 fingers.

首页