#include<bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define re register
#define il inline
template <class T> void read(T &x)
{
x=0;int f=0;char ch=getchar();
while(ch<'0'||ch>'9'){f|=(ch=='-');ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
x=f?-x:x;return ;
}
int x,n;
int main()
{
cin>>n;
char s=getchar();
for(re int i=1;i<=n;i++)
{
int pd=0,pf=0;
s=getchar();
while(s==' ') s=getchar();
if(s!='#')
{
while(s!='\n') s=getchar();
continue;
}
else
{
s=getchar();
if(s==' ')
{
pd=1;
while(s!='\n')
{
s=getchar();
if(s!=' '&&s!='\n') pf=1;
}
}
else
{
while(s!='\n')
s=getchar();
}
}
if(pd==1&&pf==1)
{
x++;
}
}
cout<<x;
return 0;
}