#include <bits/stdc++.h>
using namespace std;
int n, m, a[1010];
double c[1010][1010], ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i] > a[j]) c[i][j] = 1;
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    c[x][y] = c[y][x] = 0.5;
    for (int j = 1; j <= n; j++)
      if (j != x && j != y) {
        c[x][j] = c[y][j] = (c[x][j] + c[y][j]) / 2;
        c[j][x] = c[j][y] = (c[j][x] + c[j][y]) / 2;
      }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += c[i][j];
  printf("%.9lf", ans);
  return 0;
}
