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.OutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Adrian
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Input in = new Input(inputStream);
		Output out = new Output(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Input in, Output out)
    {
        int n = in.nextInt();
        int k = in.nextInt();
        for (int i = 1; i < n; i++) k += in.nextInt();
        int total = k+5;
        n++;
        int ways = 0;
        while (++k <= total)
            if (k % n != 1)
                ways++;
        out.println(ways);
    }
}

class Input
{
    final int SIZE = 8192;
    private InputStream in;
    private byte[] buf = new byte[SIZE];
    private int last, current, total;

    public Input(InputStream stream)
    {
        in = stream;
        last = read();
    }

    int read()
    {
        if (total == -1) return -1;
        if (current >= total)
        {
            current = 0;
            try
            {
                total = in.read(buf);
            } catch (IOException e)
            {
                e.printStackTrace();
            }
            if (total <= 0) return -1;
        }
        return buf[current++];
    }

    void advance()
    {
        while (true)
        {
            if (last == -1) return;
            if (!isValidChar(last)) last = read();
            else break;
        }
    }

    boolean isValidChar(int c)
    {
        return c > 32 && c < 127;
    }

    public boolean eof()
    {
        advance();
        return last == -1;
    }

    public String nextString()
    {
        advance();
        if (last == -1) return null;
        StringBuilder s = new StringBuilder();
        while (true)
        {
            s.appendCodePoint(last);
            last = read();
            if (!isValidChar(last)) break;
        }
        return s.toString();
    }

    String nextLine()
    {
        if (last == -1) return null;
        StringBuilder s = new StringBuilder();
        while (true)
        {
            s.appendCodePoint(last);
            last = read();
            if (last == '\n' || last == -1) break;
        }
        return s.toString();
    }

    public String nextLine(boolean ignoreIfEmpty)
    {
        if (!ignoreIfEmpty) return nextLine();
        String s = nextLine();
        while (s.trim().length() == 0) s = nextLine();
        return s;
    }

    public int nextInt()
    {
        advance();
        int n = 0, s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
        }
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last)) break;
        }
        return n * s;
    }

    public long nextLong()
    {
        advance();
        int s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
        }
        long n = 0;
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last)) break;
        }
        return n * s;
    }

    public BigInteger nextBigInt()
    {
        return new BigInteger(nextString());
    }

    public char nextChar()
    {
        advance();
        return (char) last;
    }

    public double nextDouble()
    {
        advance();
        int s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
        }
        double n = 0;
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last) || last == '.') break;
        }
        if (last == '.')
        {
            last = read();
            double m = 1;
            while (true)
            {
                m = m / 10;
                n = n + (last - '0') * m;
                last = read();
                if (!isValidChar(last)) break;
            }
        }
        return n * s;
    }

    public BigDecimal nextBigDecimal()
    {
        return new BigDecimal(nextString());
    }

    public void close()
    {
        try
        {
            in.close();
        } catch (IOException e)
        {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        in = null;
    }
}

class Output
{
    final int SIZE = 8192;
    private Writer out;
    private char cb[] = new char[SIZE];
    private int nChars = SIZE, nextChar = 0;
    private char lineSeparator = '\n';

    public Output(OutputStream stream)
    {
        out = new OutputStreamWriter(stream);
    }

    public Output(Writer writer)
    {
        out = writer;
    }

    void flushBuffer()
    {
        if (nextChar == 0) return;
        try
        {
            out.write(cb, 0, nextChar);
        } catch (IOException e)
        {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        nextChar = 0;
    }

    void write(int c)
    {
        if (nextChar >= nChars) flushBuffer();
        cb[nextChar++] = (char) c;
    }

    void write(String s, int off, int len)
    {
        int b = off, t = off + len;
        while (b < t)
        {
            int a = nChars - nextChar, a1 = t - b;

            int d = a < a1 ? a : a1;
            s.getChars(b, b + d, cb, nextChar);
            b += d;
            nextChar += d;
            if (nextChar >= nChars) flushBuffer();
        }
    }

    void write(String s)
    {
        try
        {
            out.write(s);
        } catch (IOException e)
        {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }

    public void print(Object obj)
    {
        write(String.valueOf(obj));
    }

    public void println(Object obj)
    {
        write(String.valueOf(obj));
        write(lineSeparator);
    }

    public void printf(String format, Object... obj)
    {
        write(String.format(format, obj));
    }

    public void close()
    {
        flushBuffer();
        try
        {
            out.flush();
            out.close();
        } catch (IOException e)
        {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}
