import java.io.*;

class arrays2
 { int[] ar = new int[5];
   int ct = 0;

   private void doublesize()
    {
    int b[] = new int[ar.length * 2];
     for (int x=0; x < ar.length; x++)
      b[x] = ar[x];
      ar = b;
     }

    public void enter(int n)
     {if (ct == ar.length)
       doublesize();
	  ar[ct] = n;
      ct++;
      }

    public void print()
     {for (int x=0; x < ct; x++)
        System.out.println(ar[x] + " ");
     }

    public void printreverse()
      {for (int x=ct; x >=0; x--)
        System.out.println(ar[x] + " ");}

     public void delete(int n)
      {int x = location(n);
       if (x == -1)
         return;
         boolean found = false;
         int cnt = 0;
        int b[] = new int[ar.length];
          for (int y=0; y < ct; y++)
            {if (ar[y] != n || found ==true)
              {b[cnt] = ar[y];
               cnt++;
              }
             else
              found = true;  //deleted someone
            }
            ar = b;
            ct--;
         }


      public int smallest()
       {int sm = ar[0];
        for (int x=0; x < ct; x++)
          if (ar[x] < sm)
             sm = ar[x];
           return sm;
        }

      public int biggest()
       {int big = ar[0];
        for (int x=0; x < ar.length; x++)
          if (ar[x] > big)
             big = ar[x];
           return big;
           }

      public void sort()
       {boolean sorted = false;
       int temp;
         while (! sorted)
            {sorted = true;
             for (int x=0; x < ct-1; x++)
               if (ar[x] > ar[x+1])
                 {temp = ar[x];
                  ar[x] = ar[x+1];
                  ar[x+1] = temp;
                 }
             }
         }

      public boolean inThere(int n)
        {for (int x=0; x < ct; x++)
          if (ar[x] == n)
            return true;
            return false;
           }

       public int location(int n)  // -1 if not there
        {for (int x=0 ; x< ct; x++)
         if (ar[x] == n)
          return x;
          return -1;
          }
  }