#include "stdio.h"
#include "string.h"
int stoi(int n, char s[])
{
int a = 0,t=1;
while (n--)
{
a += t*(s[n]-'0');
t *= 10;
}
return a;
}
int fun(int n, char s[])
{
char num[4][4] = { 0 };
int i, j=0,flag=0;
for (i = 0; i < n; i++)
{
if ((s[i] != '+') && (s[i] != '-')&& flag == 0)
{
num[0][j++] = s[i];
}
else if(flag == 0)
{
num[1][0] = s[i];
j = 0;
flag = 1;
continue;
}
if ((s[i] != '=')&& flag == 1)
{
num[2][j++] = s[i];
}
else if (flag == 1)
{
j = 0;
flag = 2;
continue;
}
if (((s[i] == '?') || (s[i] >= '0') && (s[i] <= '9')) && flag == 2)
{
if (s[i] == '?')
return 0;
else
num[3][j++] = s[i];
}
}
if (num[1][0] == '+')
{
if (stoi(strlen(num[0]), num[0])+ stoi(strlen(num[2]), num[2])== stoi(strlen(num[3]), num[3]))
return 1;
else
return 0;
}
else
{
if (stoi(strlen(num[0]), num[0]) - stoi(strlen(num[2]), num[2]) == stoi(strlen(num[3]), num[3]))
return 1;
else
return 0;
}
}
int main()
{
char s[10] = { 0 };
int c = 0, len;
while (scanf("%s", s) != EOF)
{
len = strlen(s);
if (fun(len, s) == 1)
c++;
memset(s, 0, sizeof(s));
}
printf("%d", c);
return 0;
}