package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var rdr = bufio.NewReaderSize(os.Stdin, 1000000) func main() { sc.Split(bufio.ScanWords) n := nextInt() m := make(map[int]int) if n == 1 { fmt.Println(1) return } ps := CalcPrimeFactors(n) for _, v := range ps { m[v]++ } sum := 0 for k, v := range m { if v%2 == 1 { sum *= k } } fmt.Println(sum) } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i } func nextInt64() int64 { i, _ := strconv.ParseInt(nextLine(), 10, 64) return i } func nextUint64() uint64 { i, _ := strconv.ParseUint(nextLine(), 10, 64) return i } func nextFloat() float64 { f, _ := strconv.ParseFloat(nextLine(), 64) return f } func readLine() string { buf := make([]byte, 0, 1000000) for { l, p, e := rdr.ReadLine() if e != nil { panic(e) } buf = append(buf, l...) if !p { break } } return string(buf) } func Generate(max int, ch chan<- int) { ch <- 2 for i := 3; i <= max; i += 2 { ch <- i } ch <- -1 // signal that the limit is reached } // Copy the values from channel 'in' to channel 'out', // removing those divisible by 'prime'. func Filter(in <-chan int, out chan<- int, prime int) { for i := <-in; i != -1; i = <-in { if i%prime != 0 { out <- i } } out <- -1 } func CalcPrimeFactors(number_to_factorize int) []int { rv := []int{} ch := make(chan int) go Generate(number_to_factorize, ch) for prime := <-ch; (prime != -1) && (number_to_factorize > 1); prime = <-ch { for number_to_factorize%prime == 0 { number_to_factorize = number_to_factorize / prime rv = append(rv, prime) } ch1 := make(chan int) go Filter(ch, ch1, prime) ch = ch1 } return rv }