#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    sum = sum + c;
  }
  n = n + 1;
  int count = 0;
  for (int j = 1; j <= 5; j++) {
    int flag = 0;
    int s = sum + j;
    if (s % n == 1) flag = 1;
    if (flag == 0) count++;
  }
  cout << count;
  return 0;
}
