# PROBLEM LINK:

Author: Aryan Agarwala

Tester: Encho Misev

Editorialist: Rajarshi Basu

# DIFFICULTY:

Cakewalk

# PREREQUISITES:

Implementation

# PROBLEM:

We are given a list of N numbers A_1,A_2, \dots A_n. We have to go from A_i to A_{i+1} in the i^{th} step. What is the total number of integers we skip in the process?

# EXPLANATION:

The solution for this is just essentially counting in **constant time** the number of integers we skip in each iteration:

- S_i = |A_{i+1} - A_i | - 1
- notice that we have to take modulus here, since we can go to a smaller integer as well.

Our final answer is

- ANS = \sum\limits_{i=1}^{n}{S_i}

# FINAL TIPS:

Don’t forget to use **long long int**s !!