import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, Ones):
  A = np.array(A)
  Ones = np.array([1]*(n-1))
  A = A -Ones
  print(n-1 -len(np.nonzero(A)[0]))
  return print_sub(A, Ones)

n= int(input())
A = [int(a) for a in input().split()]

print_sub(A, Ones)
    
print("0")
