A book has n consecutive pages torn out (each paper in a book has two sides - each side is one page). Suppose A is the last numbered page before the torn out section and B is the first numbered page following the torn-out section. Find a formula for n in terms of A and B.