#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, i, j, n, m;
  cin >> n;
  b = 0;
  for (i = 0; i < n; i++) {
    cin >> a;
    b += a;
  }
  d = 0;
  for (i = 1; i <= 5; i++) {
    c = 0;
    for (j = 1; j <= b + i; j++) {
      c++;
      if (c == n + 2) c = 1;
    }
    if (c != 1) d++;
  }
  cout << d << endl;
  return 0;
}
