#include<pthread.h>
#include<math.h>
#include<stdlib.h>
#include<unistd.h>

#define NUM_THREADS 8
int threads = 0;

typedef struct {
int rank;