#include <iostream>
#include <vector>
#include <string>
using namespace std;
// 找规律:打印出前 10000 项奇妙数,发现奇数除了 1 其他都是
// 偶数,除了 4,其他 4 的倍数都是
// 规律为 [3] [5 7 8] [9 11 12] [13 15 16]...
// 除了第一个 3,其他都可以三个三个一个周期,每个周期之间都相差 4
// 一个周期内也相差 2、1,用点数学技巧即可
vector<int> temp = { 0, 2, 3 };
int main() {
int n;
// 从标准输入读取 n 的值
cin >> n;
if (n == 1) {
// 当 n 为 1 时输出 3
cout << 3 << endl;
}
else {
// 根据规律计算并输出结果
cout << 5 + (long long)(n - 2) / 3 * 4 + temp[(n - 2) % 3] << endl;
}
return 0;
}