#include <bits/stdc++.h>
using namespace std;
void init_code() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const double EPSILON = 10e-8;
bool equal(double a, double b) { return fabs(a - b) < EPSILON; }
bool less(double a, double b) { return a < b && !equal(a, b); }
int main() {
  init_code();
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    count += arr[i];
  }
  long long ans = 0;
  for (long long i = 1; i <= 5; i++) {
    long long a = count + i, b = n + 1;
    if (a % b != 1) ans++;
  }
  cout << ans << endl;
}
