function main(arg) {
	arg = arg.split("\n")[0]

	var src = arg.split("")
	var count = 0
	for (var i  = 0; i < src.length; i++) {
		if (src[i] == "2") {
			count++
		}
	}
	console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));