import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Количество элементов массива P: ");
int n = in.nextInt();
int[] p = new int[n];
int[] m = new int[n];
int count = 0;
for (int i = 0; i < n; i++) {
p[i] = (int)(Math.random() * 61 - 30);
}
for (int i = 0; i < n; i++) {
if (p[i] % 2 == 0) {
m[count++] = p[i];
}
}
System.out.println("Массив P: " + Arrays.toString(p));
System.out.println("Массив M: " + Arrays.toString(Arrays.copyOfRange(m, 0, count)));
}
}