# PSDAUTH1 - Editorial

Tester: Ram Agrawal
Editorialist: Prathamesh Sogale

EASY

Math

# PROBLEM:

Meena is working as a security researcher in an organization. He is given a task to create an authentication system. He invented a certain term called genesis array. He defined it as an array of integers in which maximum and minimum coincide. Alongside, he also defined a term, genesis number as the number of genesis subarrays of the original array.

Now, Meena has asked your help to test his system, given an array A of length N, you have to find the genesis number of that array.

# EXPLANATION:

Declare to variables counter, ans and current as 0. Traverse the given array. If A_i = current then increment the counter else reset the counter to 0. Assign the current=A_i. Increment the ans counter times in every loop.

# SOLUTIONS:

Setter's Solution
``````from sys import stdin, stdout
def outnl(x): stdout.write(str(x) + '\n')
def outsl(x): stdout.write(str(x) + ' ')
for _ in range(int(input())):
n=int(input())
a=inlist()
ans=0
x=count=0
for i in a:
if(i==x):
count+=1
else:
count=1
x=i
ans+=count
print(ans)
``````