Counting pulses with Arduino Nano

Really guys, the Arduino was reading it correctly, but had not time enough to print it. Thank you for help. Now i just print a number when it reach 40. I was just trying to see if it identify all the 40 pulses correctly.