#include <iostream>
#include <fstream>
using namespace std;
ifstream f("BAC.TXT");
int main(){
int n=0, a=0, z=0, x, md=0;
while(f>>x){
n++;
if(md==0){
bool par=1;
while (x){
if(x%2==1)par=0;
x=x/10;
}
if(par)md=1;
else a++;
}
else {
z++;
bool impar=1;
while (x){
if(x%2==0)impar=0;
x=x/10;
}
if(impar)z=0;
}
}
cout << n-a-z;
}