Leviticus 27:26-27 - Redemption Of The Firstborn
26 "'Only the firstborn among animals, which is made a firstborn to the LORD, no man may dedicate it; whether an ox or sheep, it is the LORD's. 27 If it is an unclean animal, then he shall buy it back according to your valuation, and shall add to it the fifth part of it: or if it isn't redeemed, then it shall be sold according to your valuation.
40 The LORD said to Moses, "Number all the firstborn males of the children of Israel from a month old and upward, and take the number of their names. 41 You shall take the Levites for me (I am the LORD) instead of all the firstborn among the children of Israel; and the livestock of the Levites instead of all the firstborn among the livestock of the children of Israel." 42 Moses numbered, as the LORD commanded him, all the firstborn among the children of Israel. 43 All the firstborn males according to the number of names, from a month old and upward, of those who were numbered of them, were twenty-two thousand two hundred seventy-three.
44 The LORD spoke to Moses, saying, 45 "Take the Levites instead of all the firstborn among the children of Israel, and the livestock of the Levites instead of their livestock; and the Levites shall be mine. I am the LORD.
46 For the redemption of the two hundred seventy-three of the firstborn of the children of Israel, who exceed the number of the Levites, 47 you shall take five shekels apiece for each one; after the shekel of the sanctuary you shall take them (the shekel is twenty gerahs): 48 and you shall give the money, with which the remainder of them is redeemed, to Aaron and to his sons."
49 Moses took the redemption money from those who exceeded the number of those who were redeemed by the Levites; 50 from the firstborn of the children of Israel he took the money, one thousand three hundred sixty-five shekels, after the shekel of the sanctuary: 51 and Moses gave the redemption money to Aaron and to his sons, according to the word of the LORD, as the LORD commanded Moses.