function Main(input) {
  // 入力
  var targetStr = '2';
  var count = (input.match(new RegExp(targetStr, 'g'))||[]).length;
	//出力
	console.log('%d', count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));