Having a baby later in life can boost your brainpower, a study has found.
Women who have a child after the age of 35 have better memories in middle age than those who complete their family earlier.
It may not feel like it getting up in the early hours as an older mother, but women who have babies later are mentally sharper in verbal tests.
The research published in the Journal of the American Geriatrics Society even suggests leaving it late to start a family, or have your last child, could guard against memory loss in later life.
Researchers tested 830 middle-aged women to find the connection between a later baby and brainpower.
The reason is believed to be the surge of hormones which flood the body in pregnancy, which have been found to affect the brain's chemistry and function.
These brain changes from having a child are believed by some experts to last a lifetime, and it may be that having experienced them more recently is better.
Dr Roksana Karim, lead author of the study at the University of Southern California, said "While it is not enough to suggest that women wait until after 35 years of age to close their family growth, our finding of a positive effect of later age at last pregnancy on late-life cognition is novel and substantial."
The first study to examine how pregnancy timing affects the memory asked menopausal women to do a series of tests, including reading and remembering word lists and retelling a story they had heard after being distracted.
Women who had their first baby after the age of 24 were better at problem-solving and reasoning than those who gave birth earlier.
Those who had their last baby after 35 had better cognition and verbal memory, and having two babies was found to be better than one for the brain.
The study states: 'It has been suggested that functional brain changes induced by reproductive experiences have lifelong effects, particularly in terms of improvement in memory and learning.
"Therefore it is biologically plausible that a late pregnancy might offer protection against cognitive decline in later life."
Researchers also found that being on the contraceptive pill for more than a decade improves memory for speech and problem-solving ability.
This too is linked to the hormones found in the Pill, oestrogen and progesterone, which a significant body of research suggests can have a long-term effect on memory and cognition.
These hormones are thought to be behind similar findings that starting your period earlier boosts your brainpower.
A later period has been linked with a greater risk of Alzheimer's disease previously.
Put simply, previous studies suggest a longer reproductive life between first period and menopause is better for the brain, with pregnancy providing an extra boost.
Animal studies suggest an improvement in learning and memory begins when a woman is expecting her baby, although this has not yet been confirmed in babies.
The study states "There are robust changes in the sex steroid hormonal environment during pregnancy and in the post-partum period. Pregnancy induces a tremendous surge in oestradiol and progesterone levels."
Dr Karim added "More research is warranted to evaluate the underlying mechanism of this phenomenon and also to understand the role of age at first pregnancy."