You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right

Example Input: [71, 45, 54, 41, 73, 74, 32, 38, 53, 18]
Example Output: 2

Example Input: [81, 53, 10, 74, 25, 45, 80, 69, 44, 13]
Example Output: 2

Example Input: [99, 2, 21, 75, 68, 11, 60, 96, 30, 38]
Example Output:
2