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.StringTokenizer;
import java.util.*;
import java.math.*; 



// public
class Solution{

  static int[] sieve(int n)
    {
        boolean height[] = new boolean[n+1];
        int prime[] = new int[n+1];
        for(int i=0;i<=n;i++)
            height[i] = true;
        height[0] = false;
        height[1] = false;
        int count=0;
        for(int i=2;i*i<=n;i++)
        {
            if(height[i])
            {
                for(int j=i*i;j<=n;j+=i)
                {
                    height[j] = false;
                }
            }
        }
        int prime_prime_count = 0;
        for(int i=0;i<=n;i++)
        {
            if(height[i])
            {
               count++;
               if(height[count])
               {
                prime_prime_count++;
                prime[i] = prime_prime_count;
               }
               else
                prime[i] =prime_prime_count;

            }
            else
            {
                if(height[count])
               {
                prime_prime_count++;
                prime[i] = prime_prime_count;
               }
               else
                prime[i] =prime_prime_count;
            }
        }
        // for(int i=0;i<=n;i++)
            // System.out.println(height[i]+" "+prime[i]);
       return prime;
    }
  static class Pair{
    int strength;
    int bonus;
    Pair(int strength,int bonus)
    {
        this.strength = strength;
        this.bonus = bonus;
    }

  }
 static class SortbyStrength implements Comparator<Pair> 
{ 
    public int compare(Pair a, Pair b) 
    { 
        return a.strength - b.strength; 
    } 
} 
  private static BigInteger ncr(int n, int r) {
    BigInteger top = BigInteger.ONE;
    BigInteger bot = BigInteger.ONE;
    if(n==r)
        return top;
    for(int i = n; i >n-r; --i){
        top = top.multiply(BigInteger.valueOf(i));
    }

    for(int i = r; i > 1; --i){
        bot = bot.multiply(BigInteger.valueOf(i));
    }

    return top.divide(bot);
}
   
   public static int getCeil(ArrayList<Integer> A, int x)
    {
        int left = 0, right = A.size() - 1;
 
        int ceil = -1;
 
         while (left <= right)
        {
                int mid = (left + right) / 2;
 
              if (A.get(mid) == x) {
                return A.get(mid);
            }
 
                  else if (x < A.get(mid))
            {
                ceil = A.get(mid);
                right = mid - 1;
            }
 
            else
                left = mid + 1;
        }
 
        return ceil;
    }
     public static int getFloor(ArrayList<Integer> A, int x)
    {
        int left = 0, right = A.size() - 1;
 
        int floor = -1;
       while (left <= right)
        {
              int mid = (left + right) / 2;
 
           if (A.get(mid) == x) {
                return A.get(mid);
            }
 
                else if (x < A.get(mid)) {
                right = mid - 1;
            }
 
          else {
                floor = A.get(mid);
                left = mid + 1;
            }
        }
 
        return floor;
    }
   static ArrayList<Integer> sieveOfEratosthenes(int n) 
    { 
        ArrayList<Integer> height = new ArrayList<>();
        boolean prime[] = new boolean[n+1]; 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
        
        for(int p = 2; p*p <=n; p++) 
        { 
            if(prime[p] == true) 
            { 
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        }

        for(int i = 2; i <= n; i++) 
        { 
            if(prime[i] == true) 
                height.add(i);
        } 
        return height;
    } 
      
      static void merge(int height[], int l, int m, int r) 
    { 
       
        int n1 = m - l + 1; 
        int n2 = r - m; 

        int L[] = new int [n1]; 
        int R[] = new int [n2]; 
  

        for (int i=0; i<n1; ++i) 
            L[i] = height[l + i]; 
        for (int j=0; j<n2; ++j) 
            R[j] = height[m + 1+ j]; 
  
  
        
        int i = 0, j = 0; 
  
       
        int k = l; 
        while (i < n1 && j < n2) 
        { 
            if (L[i] <= R[j]) 
            { 
                height[k] = L[i]; 
                i++; 
            } 
            else
            { 
                height[k] = R[j]; 
                j++; 
            } 
            k++; 
        } 
  
    
        while (i < n1) 
        { 
            height[k] = L[i]; 
            i++; 
            k++; 
        } 
  
        while (j < n2) 
        { 
            height[k] = R[j]; 
            j++; 
            k++; 
        } 
    } 
  
  
   static void sort(int height[], int l, int r) 
    { 
        if (l < r) 
        { 
            int m = (l+r)/2; 
  
            sort(height, l, m); 
            sort(height , m+1, r); 
  
           merge(height, l, m, r); 
        } 
    } 
      
      public static long fibologn(long n,HashMap<Long,Long> map)
      {
        if(map.get(n)!=null) return map.get(n);
        long k = n/2;
        if(n%2==0)
        {
             map.put(n,((fibologn(k,map)*fibologn(k,map))+(fibologn(k-1,map)*fibologn(k-1,map)))%1000000007);
            return map.get(n);
        }
        else
        {
             map.put(n,((fibologn(k,map)*fibologn(k+1,map))+(fibologn(k-1,map)*fibologn(k,map)))%1000000007);
             return map.get(n);
        }

      }
    static int ceilSearch(int height[], int low, int high, int x) 
    { 
      int mid;     
        
      if(x <= height[low]) 
        return low;  
    
      if(x > height[high]) 
        return -1;   
       
      mid = (low + high)/2;  

      if(height[mid] == x) 
        return mid; 
    
      else if(height[mid] < x) 
      { 
        if(mid + 1 <= high && x <= height[mid+1]) 
          return mid + 1; 
        else
          return ceilSearch(height, mid+1, high, x); 
      } 
       
    
      { 
        if(mid - 1 >= low && x > height[mid-1]) 
          return mid; 
        else    
          return ceilSearch(height, low, mid - 1, x); 
      } 
    }
      
      public static void main(String[] args) throws Exception {
        FastScanner cin = new FastScanner(System.in);
        StringBuffer ans = new StringBuffer();
        int n = cin.nextInt();
        int sum = 0;
        for(int i=0;i<n;i++)
         sum+=cin.nextInt();
        int count =0;
        n++;
        for(int i=1;i<=5;i++)
        {
            int temp = sum+i;
            if(temp%n!=1)
                count++;
        }
        System.out.println(count);
    }
        
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
 
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
 
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
 
        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
 
            return tokenizer.nextToken("\n");
        }
 
        public long nextLong() {
            return Long.parseLong(next());
        }
         
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}