Given an array of integers, create a Binary Search Tree from these numbers. If the inserted value equals the current node, insert it to the right subtree.
Implement a method MinDepth that finds the minimum depth of the tree. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

Write the code according to the following interface:
class TreeNode
{
public:
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Tree
{
public:
TreeNode *head;
Tree() : head(NULL) {};
void Insert(int val); // Insert the number val into the Binary Search Tree
int MinDepth(void); // Return the minimum depth of the Binary Search Tree
};You may create and use additional methods if needed.

The first line contains the number (1 \le n \le 100).The second line contains integers.
Create the Binary Search Tree from the input data. Find and print its minimum depth.
Example 1