It's not that simple alas. But in principle, for most people, the time and the specific years that you spent contracted out and what the legislation was at the time, won't count towards your state pension. Henry is one of, if not the most credible commentators on state pension provision.
http://henrytapper.com/2016/04/04/the-new-state-pension-winners-and-losers/