#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    count += p;
  }
  ++n;
  int ans = 0;
  for (int i = 1; i <= 5; i++) {
    int a = count + i;
    int k = 0;
    for (int j = 1; j <= count + i; j++) {
      if (k == n) k = 0;
      a--;
      k++;
    }
    if (k != 1) ans++;
  }
  cout << ans;
  return 0;
}
