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.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        FasterScanner s = new FasterScanner();
        PrintWriter out=new PrintWriter(System.out);
        
        char[] a=s.nextLine().toCharArray();
        char[] stck = new char[a.length];
        int ptr=0;
        int n=a.length;
        int cnt=0;
        for(int i=0;i<n;i++){
        	if(a[i]=='<' || a[i]=='{' || a[i]=='(' || a[i]=='[')
        		stck[ptr++]=a[i];
        	else if(ptr<=0){
        		System.out.println("Impossible");
        		return;
        	}
        	else{
        		if(a[i]==inverse(stck[--ptr]))
        			continue;
        		if(type(a[i])!= type(stck[ptr])){
        			cnt++;
        			continue;
        		}
        		System.out.println("Impossible");
        		return;
        	}
        }
        if(ptr!=0){
        	System.out.println("Impossible");
    		return;
        }
        System.out.println(cnt);
        out.close();
    }
    static int type (char a)
    {
    	if(a=='<' || a=='{' || a=='(' || a=='[')
    		return 1;
    	return -1;
    }
    static char inverse(char a)
    {
    	if(a=='<')
    		return '>';
    	if(a=='{')
    		return '}';
    	if(a=='[')
    		return ']';
    	if(a=='(')
    		return ')';
    	return '-';
    }
    
    
    
    
    
    
    
    
    
    
    
    
    static class Node
    {
    	int id=0;
    	char ch;
    	boolean done=false;
    	Node l,r;
    	int parent=0;
    	Node(char ch){ this.ch=ch;}
		
    }
    static int gcd (long m, long n){
        long x;
        long y;
        while(m%n != 0){
            x = n;
            y = m%n;
            m = x;
            n = y;
        }
        return (int) n;
    }

    
	public static class st {
	
	    static int n;
	    static int[] t;
	    static int [] pos;
	   
	    static void build(int n2,int[] b) {  // build the tree
	       t=b;
	       n=n2;
	       pos=new int[2*n];
	       for(int i=n;i<2*n;i++)
	       {
	    	   pos[i]=i-n;
	       }
	        for (int i = n - 1; i > 0; --i)
	        {
	        	if(t[pos[i<<1]]>t[pos[i<<1|1]])
	        		pos[i]=pos[i<<1];
	        	else
	        		pos[i]=pos[i<<1|1];
	        }
	    }
	
	    static void modify(int p, int value) {  // set value at position p
	      for (t[p += n] = value; p > 1; p >>= 1) t[p>>1] = Math.max(t[p] , t[p^1]);
	    }
	
	    static int query(int l, int r) {  // sum on interval [l, r)
	      long res=-1;
	      int p=0;
	      for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
	            if ((l&1)!=0) {
	            	if(res<t[pos[l]])
	            	{
	            		res=t[pos[l]];
	            		p=pos[l];
	            	}
	            	l++;
	            }
	            if ((r&1)!=0){
	            	r--;
	            	if(res<t[pos[r]])
	            	{
	            		res=t[pos[r]];
	            		p=pos[r];
	            	}
	            }
	          }
	      return p;
	    }
	}
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    public static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = System.in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
          
        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
      
        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}