#include <iostream>
#include <stack>
using namespace std;
int n, res = 0;
stack<int> stk;
int main()
{
cin >> n;
while (n--)
{
int x;
cin >> x;
stk.push(x);
}
while(!stk.empty())
{
if (!stk.top()) res++;
stk.pop();
}
cout << res << endl;
return 0;
}