P28867 [洛谷] Typesetting
普及
题目描述

Problem Background

A certain brother school is so kind (heartless) and warm (crazy) that they filled the blackboard with National Day homework, even for information technology! Even worse, the homework is to create a "National Day Travel Plan" PPT. (Teacher, can you be any more fake?)

Problem Description

However, XHY doesn't know how to make a PPT, so she seeks help from the great CYD. She wants to arrange N photos of size 43 without overlapping or gaps to form a rectangular background image. For aesthetics, she hopes the background image's length and width are as close as possible, and if the length and width are equal, the number of rotated photos should be minimized. (43 photos are not considered rotated, while 3*4 photos are considered rotated, and photos only come in these two sizes).

Please help CYD write a program to design a photo arrangement that meets XHY's requirements with the least number of rotated photos.

Input Format

The first line contains a single positive integer N.

Output Format

A single line containing a non-negative integer representing the minimum number of rotated photos.

Sample Input and Output

Sample Input #1

6

Sample Output #1

0

Sample Input #2

7

Sample Output #2

3

Notes

For 20% of the data, N <= 10.

For 30% of the data, N <= 20.

For 50% of the data, N <= 50.

For 70% of the data, N <= 233.

For 100% of the data, N <= 900.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6
样例输出
0