#include <bits/stdc++.h>
int main() {
  long int a[1000], n, k, max = 99999, count = 0, i;
  scanf("%ld", &n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &k);
    a[k] = 1;
    if (max > k) {
      max = k;
    }
  }
  for (i = 0; i < max; i++) {
    count++;
  }
  printf("%ld", count);
  return 0;
}
