You are speaking of a legal concept in property law referred to as "adverse possession" In New Hampshire, the code (C. 508, §2.) the time is 20 years but with many elemnts that must be met.
To make a claim for adverse possession, the claimant must have acted as if he is the true owner of the property. The claimant must possess the land to the exclusion of all others. You have to keep people off and openly declare it to be your property. The plaintiff must possess the land conspicuously, that is doing things on the property that would show the world that he owns the property (such as building a house, logging or farming, planting a hedge or building a fence, just mowing it has been held by the courts to not be enough).
Further, the claimant must possess the land adversely to the actual owner. This means that the adverse possessor cannot be occupying the land with the permission of the owner. The adverse possessor and the actual title owner are often both under the mistaken belief that the adverse possessor owns the land and therefore the title owner is not giving permission to use land he does not believes he owns. Furthermore, the adverse possessor as acting as the title owner because he believes he is the title owner.
The adverse possessor must do all of the above actions continuously for a period of twenty years.

