Exemption Under Sec 54 is available upto a residential House.
A residential House should be construed as one Residential building. In CIT vs Syed Ali Adil, the Assessee purchase 2 flats one Building the is why he got the exemption U/s 54.
You asked for purchase two residential house not Flats , so as per the Case law exemption would be avilable upto one Residential house , however if you will purchase two flats in same Residential building then the exemption of Both Would be available.
in Sec 54F = The Cap gain arises from the transfer of any long term capital Asset not being a residential house property shall be exepmt if condition laid down in the act is satisfied by the assessee.
so as the NRI sold house property (assuming it as Residential House Property) in that case sec 54F is not Applicable.
& if the House property is not a Residential House preoperty then also exemption U/s 54F will not be Availaible due to the following reason
Sec 54F is not applicable in case , where the assessee owns more than one residential house , other than the new Asset on the date of Transfer of the Capital Asset. In simple Words , Exemption U/s 54F is available if the assessee on the date of Transfer owns one Residential House and Further one Residential house purchased under Section 54F i.e only 2 residential house should be owned including the house purchased using the amount of Sales Consideretion under this Section i.e 54F.