#include <bits/stdc++.h>
int n, m;
int p[1002];
double cmp[1002][1002];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j)
        cmp[i][j] = 0;
      else {
        cmp[i][j] = (double)(p[i] > p[j]);
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    for (int j = 1; j <= n; j++) {
      if (j == a || j == b) continue;
      double avg1 = (cmp[j][a] + cmp[j][b]) / 2;
      cmp[j][a] = avg1;
      cmp[j][b] = avg1;
      double avg2 = (cmp[a][j] + cmp[b][j]) / 2;
      cmp[a][j] = avg2;
      cmp[b][j] = avg2;
    }
    double avg = (cmp[a][b] + cmp[b][a]) / 2;
    cmp[a][b] = avg;
    cmp[b][a] = avg;
  }
  double E = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      E += cmp[i][j];
    }
  }
  printf("%.20f\n", E);
}
