Increasing pairs

Write a program that reads sequences of natural numbers, and that for each one prints the number of pairs of consecutive numbers such that the second number of the pair is greater than the first one.

Input

Input consists of a natural number nn, followed by nn sequences of strictly positive natural numbers. Each sequence ends with a zero.

Output

For every sequence, print in a line the number of pairs of consecutive numbers such that the second number of the pair is greater than the first one.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:45:15.245Z

© Jutge.org, 2006–2026.
https://jutge.org