#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;
const int MX = 1000005;
int dp[MX];
int solve(int n) {
if (n == 0) return 0;
if (n < 2) return 1000000000;
int& curr = dp[n];
if (curr != -1) return curr;
curr = 1 + min(solve(n-2), solve(n-3));
return curr;
}
int main() {
FAST;
memset(dp, -1, sizeof(dp));
int tc = 1, ti;
cin >> tc;
for (ti = 1; ti <= tc; ++ti) {
int n;
cin >> n;
assert(2 <= n);
cout << solve(n) << "\n";
}
return 0;
}