Strong Password

Interview

Time limit2sMemory limit512 MB

Summary
Given a string S, find the minimum number of characters to append so it has length at least 6 and contains a digit, a lowercase letter, an uppercase letter, and a special character.
Level

Easy3 of 10

Topics
String, Greedy, Implementation, Math
Solved
No attempts yet

Problem

Cublover makes games when he cannot solve a problem, and thinks about how to solve problems in his head. At last the game is finished, and its name is "Rhythm Tetris". "Rhythm Tetris" is an entertaining game that plays a rhythm game and Tetris at the same time. There is not enough room in this problem, so the link to the site where the game can be played is omitted.

To play Rhythm Tetris, you must first sign up. A user must enter an email and a password, and the password must follow the rules below.

  • The password consists only of lowercase letters, uppercase letters, digits, and special characters.
  • The password must be at least 6 characters long.
  • At least one digit must be included.
  • At least one lowercase letter must be included.
  • At least one uppercase letter must be included.
  • At least one special character must be included. The available special characters are !@#$%^&*()-+.

Gusagwa is going to sign up to play Rhythm Tetris. He intends to use the string S as his password, but it may not follow the password rules of Rhythm Tetris.

Given the string S, find the minimum number of characters that must be appended to S so that it follows the password rules of Rhythm Tetris.

Input

The first line gives the length of the string N (1 ≤ N ≤ 100), and the second line gives the string S. S consists only of lowercase letters, uppercase letters, special characters (!@#$%^&*()-+), and digits.

Output

On the first line, print the minimum number of characters that must be added to satisfy the password rules of Rhythm Tetris.

Examples4

  1. Example 1

    Input
    7
    Koosaga
    
    Expected output
    2
    
  2. Example 2

    Input
    7
    koosaga
    
    Expected output
    3
    
  3. Example 3

    Input
    7
    k@@saga
    
    Expected output
    2
    
  4. Example 4

    Input
    7
    K0@saga
    
    Expected output
    0