      include 'mpif.h'
      integer,parameter :: numdat=100
      integer,allocatable :: senddata(:),recvdata(:)
      call MPI_INIT(ierr)
      call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ierr)
      call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,ierr)
      ist = ((numdat-1)/nprocs+1)*myrank+1
      ied = ((numdat-1)/nprocs+1)*(myrank+1)
      allocate(senddata(ist:ied))
      if(myrank.eq.0) allocate(recvdata(numdat))
      icount=(numdat-1)/nprocs+1
      do i=1,icount
        senddata(icount*myrank+i)=icount*myrank+i
      enddo
      call MPI_GATHER(senddata(icount*myrank+1),
     &                icount,MPI_INTEGER,recvdata,
     &                icount,MPI_INTEGER,0,MPI_COMM_WORLD,
     &                ierr)
      if(myrank.eq.0) then
        open(60,file='fort.60')
        write(60,'(10I8)') recvdata
      endif
      call MPI_FINALIZE(ierr)
      stop
      end
