import strutils, sequtils proc makeB(A: seq[int], p: int): seq[int] = for a in A: result.safeAdd(a mod p) proc judge(B: seq[int]): bool = if B.deduplicate.len == B.len: if B[1] == B.max or B[1] == B.min: result = true let A = stdin.readLine.split.map parseInt var cnt = 0 if A.judge: echo "INF" else: for p in 1 .. A.max: if A.makeB(p).judge: cnt += 1 echo cnt