using System.Collections.Generic;
public static void Main()
var tests = new List<(int, int[])>() {
(5, new [] {1, 3, 6, 4, 1, 2}),
(3, new [] {1, -3, 6, 4, 5, 7, -1, 2}),
foreach (var test in tests) {
Console.WriteLine(string.Format("[{0}] = {1}, expected {2}.", string.Join(",", test.Item2), solution(test.Item2), test.Item1));
public static int solution(int[] A)
var B = A.Distinct().Where(a => a > 0).ToArray();
for (var i = 0; i < n; i++)