#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    sum += a;
  }
  while (sum > n + 1) {
    sum -= (n + 1);
  }
  int u = 0, counter = 0;
  bool first = true;
  while (1) {
    for (int i = 1; i <= n + 1; i++) {
      if (first) {
        first = 0;
        i += sum - 1;
        continue;
      }
      if (u == 5) {
        cout << counter;
        return 0;
      }
      if (i != 1) counter++;
      u++;
    }
  }
}
