Fundamentals of statistical mechanics