import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
private static int n;
// 组合数
private static long C(int a, int b) {
long res = 1;
for (int i = a, j = 1; j <= b; i --, j ++) {
res = res * i / j;
if (res > n) return res;
}
return res;
}
private static boolean check(int k) {
long l = k * 2, r = n;
while (l < r) {
long mid = l + r >> 1;
if (C((int) mid, k) >= n) r = mid;
else l = mid + 1;
}
if (C((int) r, k) != n) return false;
System.out.println(r * (r + 1) / 2 + k + 1);
return true;
}
public static void main(String[] args) throws IOException {
n = Integer.parseInt(reader.readLine());
for (int k = 16; ; k --)
if (check(k)) break;
reader.close();
}
}