#include<stdio.h> int main() { int a,i,j=0,n,t=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&a); t+=a; } for(i=1;i<=5;i++) { if((t+i)%(n+1)!=1) j++; } printf("%d",j); return 0; }
http://codeforces.com/contest/272/problem/A