C++:
#include <iostream>
int main()
{
int number = 0;
std::cin >> number;
while(number > 45 || number < 0)
{
std::cout << "Nhap so n khong hop le! Xin nhap lai\n";
std::cin >> number;
}
if(number == 1 || number == 0)
{
std::cout << "1\n";
}else
{
std::cout << (number - 1) + (number - 2) << std::endl;
}
return 0;
}