#include <bits/stdc++.h>
using namespace std;
int dem=0;
int a[20000];
void test(int i, int n)
{
	if (a[i]==1) dem++;
	if (i!=n) test (i+1,n);
}
int main ()
{
	freopen ("Noixich.inp", "r", stdin);
	freopen ("Noixich.out", "w", stdout);
	int n;
	cin>> n;
	for (int j=1; j<=n; j++)
	cin >> a[j];
	test (1,n);
	cout << n-dem-1;
}
