#coding:utf-8
'''
Created on 2018��3��21��
@author: larry
'''
blum = 437;
n = 0;
remainder = range(437);
dict = dict.fromkeys(remainder,0);
for num in range(1,blum):
remainder[num - 1] = num * num % blum;
#if dict.has_key(remainder[num - 1]) == True:
dict[remainder[num - 1]] = dict[remainder[num - 1]] + 1;
# else:
# dict[remainder[num - 1]] = 1;
for i in dict.keys():
if dict[i] == 4:
print(i)
n = n + 1
print(n)