The IPv4 packet headers have 16 bits reserved for the length value. The maximum value you can put in 16 bits is 65535, so that is the maximum size in bytes. To get the answer in bits, multiply by 8, and you get 524280 bits.
An IPv4 address is formed from 4 bytes. Theoretically, that gives room for 256^4 = 4294967296 ip addresses, however, several ranges are reserved for special purposes.