n=gets.to_i s=gets.chomp.reverse ans=s.index(/[AGCT]/,0) if ans.nil? then puts 0 else puts n-ans end