#include <bits/stdc++.h>
using namespace std;
const int M = 1e2 + 10;
int n;
int a[M];
bool judge(int mid) {
  int need = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] >= mid) {
      need += a[i] - mid + 1;
    }
  }
  return need <= mid - a[0];
}
int sum_of_a() {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
  }
  return sum;
}
int solve() {
  int L = a[0], R = sum_of_a(), result = R;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (judge(mid)) {
      result = mid;
      R = mid - 1;
    } else {
      L = mid + 1;
    }
  }
  return result - a[0];
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    printf("%d\n", solve());
  }
  return 0;
}
