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
#include <bits/stdc++.h>
using namespace std;
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                       {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
template <typename T, typename TT>
ostream& operator<<(ostream& s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  s << "[";
  for (int i = 0; i < ((int)(t.size())) - 1; i++) s << t[i] << ", ";
  s << t[((int)(t.size())) - 1] << "]";
  return s;
}
const int MOD = 1e9 + 7;
template <typename T>
inline T gcD(T a, T b) {
  if (a < b) swap(a, b);
  while (b) {
    a = a % b;
    b ^= a;
    a ^= b;
    b ^= a;
  };
  return a;
}
template <typename T>
inline T pow_mod(T a, T b) {
  T res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
stack<char> stk;
const int MAXN = 1e6 + 10;
char str[MAXN];
int main() {
  scanf("%s", str);
  int len = strlen(str);
  int ans = 0;
  for (int i = 0; i < len; i++) {
    if (str[i] == '[' || str[i] == '<' || str[i] == '{' || str[i] == '(')
      stk.push(str[i]);
    else {
      if (stk.empty()) {
        stk.push('g');
        break;
      } else if (stk.top() == '[' && str[i] != ']')
        ans++;
      else if (stk.top() == '{' && str[i] != '}')
        ans++;
      else if (stk.top() == '(' && str[i] != ')')
        ans++;
      else if (stk.top() == '<' && str[i] != '>')
        ans++;
      stk.pop();
    }
  }
  if (stk.size() != 0)
    printf("Impossible");
  else {
    printf("%d", ans);
    printf("\n");
  }
}
