Leviticus 27:26-27
26 ‘However, a firstborn among animals, which as a firstborn belongs to the Lord, no man may consecrate it; whether ox or sheep, it is the Lord’s. 27 But if it is among the unclean animals, then he shall redeem it according to your valuation and add to it one-fifth of it; and if it is not redeemed, then it shall be sold according to your valuation.
Numbers 3:40-51
40 Then the Lord said to Moses, “Number every firstborn male of the sons of Israel from a month old and upward, and make a list of their names. 41 You shall take the Levites for Me, I am the Lord, instead of all the firstborn among the sons of Israel, and the cattle of the Levites instead of all the firstborn among the cattle of the sons of Israel.” 42 So Moses numbered all the firstborn among the sons of Israel, just as the Lord had commanded him; 43 and all the firstborn males by the number of names from a month old and upward, for their numbered men were 22,273.
44 Then the Lord spoke to Moses, saying, 45 “Take the Levites instead of all the firstborn among the sons of Israel and the cattle of the Levites. And the Levites shall be Mine; I am the Lord.
46 For the ransom of the 273 of the firstborn of the sons of Israel who are in excess beyond the Levites, 47 you shall take five shekels apiece, per head; you shall take them in terms of the shekel of the sanctuary (the shekel is twenty gerahs), 48 and give the money, the ransom of those who are in excess among them, to Aaron and to his sons.”
49 So Moses took the ransom money from those who were in excess, beyond those ransomed by the Levites; 50 from the firstborn of the sons of Israel he took the money in terms of the shekel of the sanctuary, 1,365. 51 Then Moses gave the ransom money to Aaron and to his sons, at the command of the Lord, just as the Lord had commanded Moses.