#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 69;
const int INF = 1e9 + 85;
const int MOD = 998244353;
int t, n, ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    ans = 0;
    if (n % 2 == 1) n -= 3, ans++;
    ans += n / 2;
    cout << ans << "\n";
  }
}
