Company: Hsbc
Difficulty: medium
Triplet Equation You are given a number N . Find and print the number of triplets (X, Y, Z) possible that satisfy the following condition: X * Y + Z = N X , Y and Z must all be positive integers. Two triplets are different if they differ in at least one of the three positions, so (1, 2, 1) and (2, 1, 1) are counted as two different triplets. Input Format The input consists of a single line: The line contains a single integer denoting N . Input will be read from the STDIN by the candidate. Output Format Print the number of triplets possible. The output will be matched to the candidate's output printed on the STDOUT. Constraints 1 <= N <= 10^5 N is an integer. X , Y and Z must be positive integers. The answer never exceeds 1166714 (attained at N = 10^5 ), so a 32-bit signed integer is sufficient. (inferred — the source states no bound on the answer; this value was produced by running the reference solution at the maximum N .) Example 1 Input: 3 Output: 3 Explanation: three triplets