You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it by ) or >.

The following definition of a regular bracket sequence is well-known, so you can be familiar with it.

Let's define a regular bracket sequence (RBS). Empty string is RBS. Let s1 and s2 be a RBS then the strings <s1>s2, {s1}s2, [s1]s2, (s1)s2 are also RBS.

For example the string "[[(){}]<>]" is RBS, but the strings "[)()" and "][()()" are not.

Determine the least number of replaces to make the string s RBS.

Input

The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106.

Output

If it's impossible to get RBS from s print Impossible.

Otherwise print the least number of replaces needed to get RBS from s.

Examples

Input

[&lt;}){}


Output

2

Input

{()}[]


Output

0

Input

]]


Output

Impossible
import java.util.*;

import java.io.*;

import java.math.*;
public class Solution implements Runnable{
    FastScanner sc;
    PrintWriter pw;
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
 
        public long nlo() {
            return Long.parseLong(next());
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }
 
        public int ni() {
            return Integer.parseInt(next());
        }
 
        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
 
        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args) throws Exception
    {
        new Thread(null,new Solution(),"codeforces",1<<28).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
        try{solve();}
        catch(Exception e)
        {System.out.println(e);}
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    public  int gcd(int x,int y)
    {
        return y==0?x:gcd(y,x%y);
    }
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////

    public void solve() throws Exception
    {
      char[] arr=sc.next().toCharArray();
      int o=0,n=arr.length;
      for(int i=0;i<n;i++)
      {
        if(arr[i]=='('||arr[i]=='['||arr[i]=='<'||arr[i]=='{')
        o++;
        else
        o--;
        if(o<0)
        {
            pw.println("Impossible");
            return;
        }
      }
      if(o!=0)
      {
          pw.println("Impossible");return;
      }
      int a=0,b=0,c=0,d=0,ans=0;
      Stack<Integer> stk=new Stack();
      for(int i=0;i<n;i++)
      {
          if(arr[i]=='(')
          {a++;stk.push(i);}
          else if(arr[i]=='{')
          {b++;stk.push(i);}
          else if(arr[i]=='<')
          {c++;stk.push(i);}
          else if(arr[i]=='[')
          {d++;stk.push(i);}
          else if(arr[i]==')')
          {
              if(arr[stk.peek()]!='(')
              ans++;
              stk.pop();
          }
          else if(arr[i]=='}')
          {
            if(arr[stk.peek()]!='{')
            ans++;
            stk.pop();
          }
          else if(arr[i]=='>')
          {
            if(arr[stk.peek()]!='<')
              ans++;
              stk.pop();
          }
          else if(arr[i]==']')
          {
            if(arr[stk.peek()]!='[')
            ans++;
            stk.pop();
          }
      }
      pw.println(ans);
    }
}