#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define rrep(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int n;

int main(){
  while(cin >> n, n){
    bitset<11234> a;
    rep(i, 1, n) a[i * i % n] = 1;
    for(int i = 1; i <= n / 2; ++i){
      int cnt = 0;
      REP(j, n) if(a[j] && a[(j + i) % n]) ++cnt;
      cout << cnt * 2 << endl;
    }
  }
}

