import java.util.Scanner;
class Main
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int times = in.nextInt();
int sum = 0;
for (int i = 0; i < times; ++i)
{
int a = 0, b = 0;
char op = 0;
a = in.nextInt();
op = in.next().charAt(0);
b = in.nextInt();
if (isEqualNine(a, op, b))
++sum;
}
System.out.println(sum);
}
public static boolean isEqualNine(int a, char b, int c)
{
switch (b)
{
case '+':
return (9 == (a+c));
case '-':
return (9 == (a-c));
case '*':
return (9 == (a*c));
case '/':
return ((a % c == 0) && 9 == (a/c));
}
return false;
}
}