#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n + 1]; int sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } int avg = sum / n; int count = 0; for (int i = 1; i <= n; i++) { if (a[i] != avg) { a[i + 1] += a[i] - avg; count++; } } cout << count << endl; return 0; }