<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Split an array into equal length subsequences consisting of equal elements only
Python3 program for the above approach ; Function to find the GCD of two numbers a and b ; Function to check if it is possible to split the array into equal length subsequences such that all elements in the subsequence are equal ; Store frequencies of array elements ; Traverse the array ; Update frequency of arr [ i ] ; Store the GCD of frequencies of all array elements ; Traverse the map ; Update GCD ; If the GCD is greater than 1 , print YES otherwise print NO ; Driver Code ; Given array ; Store the size of the array

<ASSISTANT_TASK:>
Python Code:
from collections import defaultdict 
 def gcd(a , b ) : 
	 if(b == 0 ) : 
	 return a 
  return gcd(b , a % b ) 
  def splitArray(arr , N ) : 
	 mp = defaultdict(int ) 
 for i in range(N ) : 
	 mp[arr[i ] ] += 1 
  G = 0 
 for i in mp : 
	 G = gcd(G , mp[i ] ) 
  if(G > 1 ) : 
	 print("YES ") 
  else : 
	 print("NO ") 
   if __name__== "__main __": 
	 arr =[1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 ] 
 n = len(arr ) 
 splitArray(arr , n ) 
 
<END_TASK>
