using System;
public class Program
{
public static void Main()
Console.WriteLine(isSystematicallyIncreasing(new int[]{1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6}));
}
static int isSystematicallyIncreasing(int[] a)
int preNum = 1;
for(int i = 0; i < a.Length; i++)
if(i == 0 || i == 1)
if(a[i] != 1)
return 0;
if(a[i] == 1 && i > 1)
if(a[i -1] != preNum + 1)
preNum = a[i -1 ];
if((a[i] != 1 && a[i] != a[i - 1] + 1) || a[i] > preNum +1)
return 1;