#include <stdio.h>
// #include <stdlib.h>

const int MAX_TEMBODAI_NUMBER = 9999999;

typedef struct {
  short height;
  short is_good;
} Tembodai;

// 降順
/* static int compareFunction(const void *lhs, const void *rhs) { */
/*   return ((Tembodai *)rhs)->height - ((Tembodai *)lhs)->height; */
/* } */

int main() {
  short tembodai_count, temboway_count;
  scanf("%hd %hd", &tembodai_count, &temboway_count);

  Tembodai tembodai[tembodai_count];
  for (short i = 0; i < tembodai_count; i += 1) {
    scanf("%hd", &tembodai[i].height);
    tembodai[i].is_good = 0;
  }
  // qsort(tembodai, tembodai_count, sizeof(*tembodai), compareFunction);

  short temboway_array[temboway_count][2];
  for (short j = 0; j < temboway_count; j += 1) {
    scanf("%hd %hd", temboway_array[j], temboway_array[j] + 1);

    if (tembodai[temboway_array[j][0]].height > tembodai[temboway_array[j][1]].height) {
      if (tembodai[temboway_array[j][1]].is_good == 1) {
        tembodai[temboway_array[j][1]].is_good = 0;
      } else {
        tembodai[temboway_array[j][0]].is_good = 1;
      }
    } else if (tembodai[temboway_array[j][0]].height < tembodai[temboway_array[j][1]].height) {
      if (tembodai[temboway_array[j][0]].is_good == 1) {
        tembodai[temboway_array[j][0]].is_good = 0;
      } else {
        tembodai[temboway_array[j][1]].is_good = 1;
      }
    }
  }

  short output = 0;
  for (short k = 0; k < tembodai_count; k += 1) {
    if (tembodai[k].is_good == 1) {
      output += 1;
    }
  }

  printf("%hd", output);
  printf("%c", '\n');

  return 0;
}
