package main import "fmt" func main() { var n int var lower, lowerindex int fmt.Scanf("%v", &n) neighbours := make([]int,100) //saved := make([]int,n) for i := 0; i < n; i++ { fmt.Scanf("%v",&lower) lowerindex = lower - 1 // if the low value of our range is equal to current, or to current - 1, then current will be counted neighbours[lowerindex] = neighbours[lowerindex] + 1 if lowerindex >= 1 { neighbours[lowerindex - 1] = neighbours[lowerindex - 1] + 1 } //fmt.Println(neighbours) } var max int for j := 0; j < 100; j++ { if neighbours[j] > max { //index = j + 1 max = neighbours[j] } } //fmt.Println(neighbours) //fmt.Println("Index: ",index) fmt.Println(max) }