n people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2, 3, ..., n - 1 friends among those who stayed by the moment of their leaving, did the same.

What is the maximum amount of people that could stay at the party in the end? 

Input

The first input line contains one number t — amount of tests (1 ≤ t ≤ 105). Each of the following t lines contains one integer number n (1 ≤ n ≤ 105).

Output

For each test output in a separate line one number — the maximum amount of people that could stay in the end.

Examples

Input

1
3


Output

1
#include <bits/stdc++.h>
using namespace std;
class myistream {
  static const int maxsize = 1000007, tmpsize = 50;
  char *s, *tmp;
  char *cur, *upperbound;
  FILE *fp;
  bool last_read;
  bool end_of_file;
  bool to_return;
  void upd() {
    int num = fread(s, sizeof(char), maxsize, fp);
    if (num < maxsize) last_read = true, upperbound = s + num;
    if (!num) end_of_file = true;
    cur = s;
  }
  char scan() {
    if (cur >= upperbound) {
      if (last_read)
        end_of_file = true;
      else
        upd();
    }
    return *cur++;
  }
  bool isspace(char c) {
    return c == ' ' || c == '\n' || c == '\r' || c == '\t';
  }

 public:
  myistream(FILE *_fp)
      : last_read(false), end_of_file(false), to_return(false), fp(_fp) {
    s = new char[maxsize + 2];
    tmp = new char[tmpsize + 2];
    upperbound = s + maxsize;
    cur = s + maxsize;
  }
  ~myistream() {
    delete[] s;
    delete[] tmp;
    fclose(fp);
  }
  operator void *() const { return to_return ? 0 : (void *)this; }
  bool operator!() const { return to_return; }
  myistream &operator>>(int &a) {
    if (!end_of_file) {
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      if (end_of_file) {
        to_return = true;
        return *this;
      }
      a = 0;
      bool nega = false;
      if (c == '-') nega = true, c = scan();
      while (!isspace(c) && !end_of_file) {
        a = a * 10 + (((int)c) & 15);
        c = scan();
      }
      if (nega) a = -a;
    } else
      to_return = true;
    return *this;
  }
  myistream &operator>>(long long &a) {
    if (!end_of_file) {
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      if (end_of_file) {
        to_return = true;
        return *this;
      }
      a = 0;
      bool nega = false;
      if (c == '-') nega = true, c = scan();
      while (!isspace(c) && !end_of_file) {
        a = a * 10 + (((long long)c) & 15);
        c = scan();
      }
      if (nega) a = -a;
    } else
      to_return = true;
    return *this;
  }
  myistream &operator>>(char &c) {
    if (!end_of_file) {
      c = scan();
      while (isspace(c) && !end_of_file) c = scan();
    }
    if (end_of_file) to_return = true;
    return *this;
  }
  myistream &operator>>(bool &b) {
    if (!end_of_file) {
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      b = (c == '1');
    }
    if (end_of_file) to_return = true;
    return *this;
  }
  myistream &operator>>(char *s) {
    if (!end_of_file) {
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      if (end_of_file) {
        to_return = true;
        return *this;
      }
      while (!isspace(c) && !end_of_file) *s++ = c, c = scan();
      *s = '\0';
    } else
      to_return = true;
    return *this;
  }
  myistream &operator>>(string &s) {
    s.clear();
    if (!end_of_file) {
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      if (end_of_file) {
        to_return = true;
        return *this;
      }
      while (!isspace(c) && !end_of_file) s.push_back(c), c = scan();
    } else
      to_return = true;
    return *this;
  }
  myistream &operator>>(double &d) {
    if (!end_of_file) {
      char *tp = tmp;
      char c = scan();
      while (isspace(c) && !end_of_file) c = scan();
      if (end_of_file) {
        to_return = true;
        return *this;
      }
      while (!isspace(c) && !end_of_file) *tp++ = c, c = scan();
      *tp = '\0';
      sscanf(tmp, "%lf", &d);
    } else
      to_return = true;
    return *this;
  }
};
class myostreamEndltype {};
class myostream {
  static const int maxsize = 1000007, tmpsize = 50;
  char *s, *upperbound, *cur, *tmp;
  FILE *fp;
  void write(char c) {
    if (cur >= upperbound) {
      fwrite(s, sizeof(char), maxsize, fp);
      cur = s;
    }
    *cur++ = c;
  }

 public:
  myostream(FILE *_fp) : fp(_fp) {
    s = new char[maxsize];
    tmp = new char[tmpsize + 2];
    upperbound = s + maxsize;
    cur = s;
  }
  ~myostream() {
    fwrite(s, sizeof(char), cur - s, fp);
    fclose(fp);
    delete[] s;
  }
  myostream &operator<<(const char &c) {
    write(c);
    return *this;
  }
  myostream &operator<<(const myostreamEndltype &e) {
    write('\n');
    return *this;
  }
  myostream &operator<<(const bool &b) {
    write(b ? '1' : '0');
    return *this;
  }
  myostream &operator<<(const char *c) {
    for (const char *p = c; *p; p++) write(*p);
    return *this;
  }
  myostream &operator<<(const string &c) { return this->operator<<(c.c_str()); }
  myostream &operator<<(const int &a) {
    if (a == 0) {
      write('0');
      return *this;
    }
    int s = a;
    if (s < 0) write('-'), s = -s;
    char *tp = tmp;
    while (s > 0) {
      *tp++ = char((s % 10) | 48);
      s /= 10;
    }
    for (--tp; tp >= tmp; --tp) write(*tp);
    return *this;
  }
  myostream &operator<<(const long long &a) {
    if (a == 0) {
      write('0');
      return *this;
    }
    long long s = a;
    if (s < 0) write('-'), s = -s;
    char *tp = tmp;
    while (s > 0) {
      *tp++ = char((s % 10) | 48);
      s /= 10;
    }
    for (--tp; tp >= tmp; --tp) write(*tp);
    return *this;
  }
};
myostreamEndltype myostreamendl;
myistream in(stdin);
myostream out(stdout);
int main(void) {
  int n;
  in >> n;
  for (int i = 0; i < (n); ++i) {
    int a;
    in >> a;
    out << max(a - 2, 0) << myostreamendl;
  }
  return 0;
}
