아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Campfire Riddle

시간 제한1초메모리 제한1024 MB

요약
n명에 대해 친구 수가 같은 사람끼리만 친구가 되도록 할 때 가능한 친구 쌍 개수의 최솟값을 구한다.
난이도

보통10점 중 6점

유형
수학, 구현
정답자
아직 제출이 없습니다

문제

One day Yurik found himself in a forest near the campfire where nn people had gathered.

It turned out that some of them are friends. Let's number all people with integers from 11 to nn. Let's denote the number of people that are friends with the ii-th person, as d_id\_i. It suddenly turned out that two people with numbers ii and jj (i≠ji \ne j) are friends if and only if d_i=d_jd\_i = d\_j.

When Yurik came home he got curious, what is the minimum number of pairs of people that could be friends, so that the condition described above to be satisfied?

입력

The only line contains one integer nn (1≤n≤5,0001 \le n \le 5\\,000) --- the number of people.

출력

Print one integer --- the minimum number of pairs of friends.

힌트

Consider the first example. All possible cases are described below:

  1. Each two people are friends with each other. In this case the number of pairs of friends is 4⋅32=6\frac{4 \cdot 3}{2} = 6.
  2. Three people are pairwise friends with each other, and the fourth person is not friend with anyone. In this case the number of pairs of friends is 33.

예제2

  1. 예제 1

    입력
    4
    
    예상 출력
    3
    
  2. 예제 2

    입력
    5
    
    예상 출력
    4