#include <bits/stdc++.h>
using namespace std;
int a[10005];
int main() {
  int n, m;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> m;
    sum += m;
    a[m] = 1;
  }
  if ((sum / n * n) != sum) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
}
