#include <bits/stdc++.h>
using namespace std;
int caseno = 1;
typedef long long LL;
typedef unsigned long long ULL;
typedef long long int64;
typedef unsigned long long uint64;
const int SIZE = 100 + 10;
int ar[SIZE];
int main() {
  std::ios_base::sync_with_stdio(0);
  int tcases, I, J, K, N, n, m, cnt = 0, len, f = 0, x, D, t;
  cin >> n;
  for (I = 0; I < n; I++) {
    cin >> ar[I];
    f += ar[I];
  }
  n++;
  D = 1;
  t = f;
  t += D;
  I = 1;
  x = 1;
  while (1) {
    x++;
    if (I == n)
      I = 1;
    else
      I++;
    if (x == t) break;
  }
  if (I != 1) cnt++;
  D = 2;
  t = f;
  t += D;
  I = 1;
  x = 1;
  while (1) {
    x++;
    if (I == n)
      I = 1;
    else
      I++;
    if (x == t) break;
  }
  if (I != 1) cnt++;
  D = 3;
  t = f;
  t += D;
  I = 1;
  x = 1;
  while (1) {
    x++;
    if (I == n)
      I = 1;
    else
      I++;
    if (x == t) break;
  }
  if (I != 1) cnt++;
  D = 4;
  t = f;
  t += D;
  I = 1;
  x = 1;
  while (1) {
    x++;
    if (I == n)
      I = 1;
    else
      I++;
    if (x == t) break;
  }
  if (I != 1) cnt++;
  D = 5;
  t = f;
  t += D;
  I = 1;
  x = 1;
  while (1) {
    x++;
    if (I == n)
      I = 1;
    else
      I++;
    if (x == t) break;
  }
  if (I != 1) cnt++;
  cout << cnt << '\n';
  return 0;
}
