#P1806. Increasing Lap Run Patterns

    ID: 15089 Type: Default 1000ms 256MiB

Increasing Lap Run Patterns

Increasing Lap Run Patterns

A runner plans to run n laps to exercise. He intends to complete these laps in multiple sessions (more than one), and in each session he runs a positive integer number of laps. After each session he takes a rest before continuing.

To effectively boost his endurance, he decides that in each subsequent session he must run more laps than in the previous session. Assuming he starts from 0 laps, the problem is to determine in how many different ways he can finish running exactly n laps.

Formally, if we denote the number of laps in each session by \(a_1, a_2, \ldots, a_k\) where \(k > 1\), the following conditions must hold:

  • \(a_i\) is a positive integer for all \(i\).
  • \(a_1 < a_2 < \ldots < a_k\).
  • \(a_1 + a_2 + \cdots + a_k = n\).

Output the number of different ways to partition n into an increasing sequence of positive integers (with at least 2 terms).

inputFormat

The input consists of a single integer n (\(n\geq 1\)).

outputFormat

Output a single integer representing the number of ways to partition n into a strictly increasing sequence of positive integers, where the sequence has at least two elements.

sample

3
1