The present invention provides a novel compound having an antiviral activity, in particular, an HIV replication inhibiting activity, as well as a pharmaceutical composition, in particular, an anti-HIV agent. wherein ring A is substituted or unsubstituted carbocycle or substituted or unsubstituted heterocycle R 1 is substituted or unsubstituted alkyl etc. R 2 is substituted or unsubstituted alkyloxy etc. n is 1 or 2 R 3 is substituted or unsubstituted carbocyclyl or substituted or unsubstituted heterocyclyl R 4 is a hydrogen atom etc. R 6 is substituted or unsubstituted alkyl etc.