There are basically three requirements each of which must be met.
* First, you have to count the number of days in the five years before you file your N-400. Add up the number of days. You must have lived in the United States for at least half of the total number of days.
* Second, no single trip abroad during the five year period can be greater than one year. Having a reentry permit does not solve this problem. If you are outside the U.S. for more than one year then once you come back you start from square one (you can try to get an exception by filing a N-470 petition with the USCIS)
* lastly a trip greater than 6 months will be deemed to break the residence period unless you can present evidence to rebut it.