```
import java.util.Scanner;

public class People
{
    public static final Scanner keyboard = new Scanner(System.in);
    static final int Max= 50;

    public static void main(String[]args)
    {
        int index;
            int check;
            int infants = 0, children = 0, teens = 0, adults = 0;
            System.out.println("Please enter value:");
            int [] peopleTypes = new int[Max];

            for(index=0; index<Max; index++)
                {
                    peopleTypes[index] = keyboard.nextInt();
                    if(peopleTypes[index] == 1)
                        infants = infants + 1;
                    if(peopleTypes[index] == 2)
                        children = children + 1;
                    if(peopleTypes[index] == 3)
                        teens = teens + 1;
                    if(peopleTypes[index] == 4)
                        adults = adults + 1;
                    else
                        index = index-1;
                    System.out.print("");
                }

```

So basically I have to create a code that allows a user to input 50 values (1,2,3,4) into a array and count how many of each was inputted and outputs that. I am stuck on creating the code to count the inputted values. I am new to array and am not sure if I'm on the right path.