program one_two_three_triangle
  implicit none
  integer :: n, a(1000000) = 0, i, j
  character(1000000) :: s
  read(*,*) n
  read(*,*) s
  do i = 1, n
    a(i) = ichar(s(i:i)) - 48
  end do
  do i = n - 1, 1, -1
    do j = 1, i
      a(j) = abs(a(j) - a(j + 1))
    end do
  end do
  write(*,'(i0)') a(1)
end program one_two_three_triangle