1. 
/*
* ACM Contest training
* Problem: 11878 - Homework Checker
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=226&page=show_problem&problem=3000
*
* @author Christoph Goettschkes
* @version 1.0, 11/08/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.124
*/

import java.io.*;

class Main
{
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int counter = 0;

do
{
String line = reader.readLine().trim();

line = line.replaceAll("\\s", "");

if (line.indexOf('?') < 0)
{

int sign = line.indexOf('-');
char signChar = '-';
if (sign == -1) {
sign = line.indexOf('+');
signChar = '+';
}

int equ = line.indexOf('=');

int c = Integer.parseInt(line.substring(equ+1));

int a = Integer.parseInt(line.substring(0, sign));
int b = Integer.parseInt(line.substring(sign+1, equ));

int calcC = (signChar == '+') ? a + b : a - b;

if (calcC == c)
counter++;
}
} while(reader.ready());
System.out.println(counter);
reader.close();
}
}