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 7 fingers were shown during the counting-out, then Dima would clean the place. If there were 2 or say, 8 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.

Input

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

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

Output

In a single line print the answer to the problem.

Examples

Input

1
1


Output

3


Input

1
2


Output

2


Input

2
3 5


Output

3

Note

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

In the second sample Dima can show 2 or 4 fingers.
import java.io.*;
import java.util.*;

public class Main
{
    static InputReader in;
    static OutputWriter out;
    static final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;

    public static void main(String[] args) throws IOException
    {
        in = new InputReader(OJ ? System.in : new FileInputStream("in.txt"));
        out = new OutputWriter(OJ ? System.out : new FileOutputStream("out.txt"));
        run();
        out.close();
        System.exit(0);
    }

    private static void run() throws IOException
    {
        int n = in.getInt();
        int k = in.getInt();
        for (int i = 1; i < n; i++) k += in.getInt();
        int total = k+5;
        n++;
        int ways = 0;
        while (++k <= total)
            if (k % n != 1)
                ways++;
        out.println(ways);
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer st;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream), 1024);
    }

    public String getString() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
        {
            String line = reader.readLine();
            if (line == null) return null;
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public String getLine() throws IOException
    {
        return reader.readLine();
    }

    public int getInt() throws IOException
    {
        return Integer.parseInt(getString());
    }

    public long getLong() throws IOException
    {
        return Long.parseLong(getString());
    }

    public double getDouble() throws IOException
    {
        return Double.parseDouble(getString());
    }

    public boolean ready() throws IOException
    {
        return reader.ready();
    }

    public int[][] getIntTable(int rowCount, int columnCount) throws IOException
    {
        int[][] table = new int[rowCount][];
        for (int i = 0; i < rowCount; i++) table[i] = getIntArray(columnCount);
        return table;
    }

    public int[] getIntArray(int len) throws IOException
    {
        int[] table = new int[len];
        for (int i = 0; i < len; i++) table[i] = getInt();
        return table;
    }
}

class OutputWriter
{
    private PrintWriter writer;

    public OutputWriter(OutputStream stream)
    {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));
    }

    public void print(Object... objects)
    {
        for (int i = 0; i < objects.length; i++)
        {
            if (i != 0) writer.print(' ');
            writer.print(objects[i].toString());
        }
    }

    public void print(String s, Object... objects)
    {
        for (int i = 0; i < objects.length; i++)
        {
            if (i != 0) writer.print(s);
            writer.print(objects[i].toString());
        }
    }

    public void println(Object... objects)
    {
        print(objects);
        writer.println();
    }

    public void printf(String format, Object... objects)
    {
        writer.printf(format, objects);
    }

    public void close()
    {
        writer.close();
    }
}