An n-digit number is a positive number with exactly n digits. Nine hundered distinct n-digit numbers are to be formed using only three digits 2, 5 and 7.The smallest value of n for which this is possible is ___