The formula for gaining weight (and losing it) is actually pretty simple: If you put more calories in than you burn, the number on your scale has no choice but to go up. The hard part, of course, is figuring out where those numbers actually lie.

As the body’s primary energy source, calories get used up at different rates for each person. These rates depend on several factors, such as age, sex, weight, and activity level. A leaner body (meaning it has less fat to muscle), for example, demands more energy to stay at its current weight than a fattier body. This is also why men need more calories than women and people in their mid-20s need more calories than older people. Their bodies simply burn energy more quickly.

Guidelines from the U.S. Department of Agriculture suggest women who are 19 to 30 years old should consume between 1,800 and 2,400 calories a day, depending on their activity level. Men of the same age should get between 2,400 and 3,000. The extent to which people eat at a caloric surplus or deficit will determine how quickly they lose weight and to what magnitude, which ultimately answers the question “How many calories should you eat in a day?” with the unsatisfying answer: It depends.

Weight management over the long-term doesn’t carry a complicated set of equations. It’s all about energy balance and priorities, coupled with the basic knowledge that one gram of fat, protein, and carbohydrates come with nine, four, and four calories, respectively. It’s important to keep these in mind when designing a diet that meets your caloric needs. High-fat foods like butter and red meat deliver more calories, which can be good for prolonged energy, but also lead to weight gain if those calories don’t get burned off.

Of course, whether that’s a good or bad thing is up to you.