#include <bits/stdc++.h>
using namespace std;
long long n;
long long tag[5004], s[5004];
class BFS {
 public:
  long long GenKey(long long x, long long y, long long isRight) {
    return (x << 33) | (y << 1) | isRight;
  }
  void FromKey(long long key, long long &x, long long &y, long long &isRight) {
    x = key >> 33;
    y = (key >> 1) & 0xFFFFFFFFLL;
    isRight = key & 1;
  }
  long long GenValue(long long score, long long degree) {
    return (score << 1) | degree;
  }
  long long Dist(long long x, long long y) {
    return tag[x] == tag[y] ? -0x7fffffffffff : llabs(s[x] - s[y]);
  }
  void FromValue(long long value, long long &score, long long &degree) {
    score = value >> 1;
    degree = value & 1;
  }
  void Update(long long isRight, long long x, long long y, long long score) {
    if (x < 0 || x >= y || y >= n) return;
    long long key = GenKey(x, y, isRight);
    auto iter = result.find(key);
    if (iter == result.end()) {
      long long degree = 0;
      if (isRight) {
        if (y < n - 1) degree += 2;
        if (x > 0) degree++;
      } else {
        if (y < n - 1) degree++;
        if (x > 0) degree++;
      }
      assert(degree > 0);
      if (--degree == 0) {
        list.push(make_pair(key, score));
      } else {
        --degree;
        assert(degree <= 1);
        result[key] = GenValue(score, degree);
      }
    } else {
      long long map_score, map_degree;
      FromValue(iter->second, map_score, map_degree);
      score = max(score, map_score);
      if (map_degree == 0) {
        list.push(make_pair(key, score));
        result.erase(iter);
      } else {
        iter->second = GenValue(score, 0);
      }
    }
  }
  long long MainLoop() {
    long long init_score = tag[0] == tag[n - 1] ? 0 : llabs(s[0] - s[n - 1]);
    list.push(make_pair(GenKey(0, n - 1, 0), init_score));
    list.push(make_pair(GenKey(0, n - 1, 1), init_score));
    long long ans = 0;
    long long times = 0;
    long long ktimes = 0;
    while (!list.empty()) {
      times++;
      auto cur = list.front();
      list.pop();
      long long x, y, isRight;
      FromKey(cur.first, x, y, isRight);
      long long score = max(cur.second, Dist(x, y));
      if (score > ans) ans = score;
      if (isRight) {
        if (y > 0) {
          Update(1, x, y - 1, score);
          Update(0, x, y - 1, score + Dist(x, y - 1));
        }
        if (x + 1 == y) {
          for (long long i = 0; i < x; ++i) {
            ktimes++;
            Update(1, i, x, score + Dist(i, x));
          }
        }
      } else {
        if (x < y - 1) {
          Update(0, x + 1, y, score);
          Update(1, x + 1, y, score + Dist(x + 1, y));
        }
      }
    }
    printf("mapsize = %lld times = %lld, ktimes=%lld\n", result.size(), times,
           ktimes);
    return ans;
  }
  unordered_map<long long, long long> result;
  queue<pair<long long, long long> > list;
};
int32_t main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    for (long long i = 0; i < n; ++i) tag[i] = i + 1;
    for (long long i = 0; i < n; ++i) s[i] = i + 1;
    BFS bfs_obj;
    printf("%lld\n", bfs_obj.MainLoop());
  }
}
