Igor did not practice mathematics at all over the summer holidays, and a few days before school started he realized that he no longer remembers the basic arithmetic operations. Now he keeps pestering his brother Davor to help him practice.
To make the practice interesting, Davor told Igor to think of an integer. Then he told him several times to add another integer to it, subtract one from it, multiply it by one, or divide it by one. For division Igor always uses integer division that truncates toward zero. For example, dividing −27 by 10 gives −2. At the end of the practice Igor says the final result out loud, and it is up to Davor to guess which number Igor thought of at the start.
Write a program that determines how many different integers Igor could have thought of, given the operations and the final result.