When it comes to losing weight, the simple math of counting calories doesn't always add up. This was reported by Qazaqyia.kz citing Associated Press.

Fad diets come and go, but the underlying message almost always follows a simple equation. If you consume fewer calories than you burn, the weight will melt away. In principle, it's true. And counting calories can be a useful tool for managing weight. But it only works if you know what numbers you're counting. And what's been billed as basic math can sometimes look more like Einstein's theory of relativity.

That's because a complex web of factors influences how or even if our bodies process calories. And it turns out diet quality is just as important as quantity, and possibly more.

"Different foods have very different effects on the brain, liver, fat cells, muscle function, pancreas and all organs related to metabolism and body weight," said Dr. Dariush Mozaffarian, a cardiologist and director of the Food is Medicine Institute at Tufts University.

A calorie is the unit of energy used to count what the body can get from carbohydrates, proteins and fats. That sounds simple, but the complexity of counting calories went mainstream recently, when a lawsuit accused the maker of David protein bars of affixing labels that misrepresent how many calories and how much fat the products contain. The lawsuit has since been dropped.

The allegations were based on an analysis of the bars using bomb calorimetry, which measures calories by burning food and calculating the amount of heat released, a method that counts every potential calorie. But our bodies aren't combustion chambers and don't treat all calories the same. The company's numbers, like many food labels, are based only on the calories our bodies can actually use. Technically, both are correct, but only the latter matters for diet.

"You could put sawdust into a bomb calorimeter and you would get basically 4 calories per gram," said Dr. David Ludwig, an endocrinologist and researcher at Boston Children's Hospital. "If you're a termite, yes, you'll get calories from it. But humans won't."