#include <bits/stdc++.h>
const int N = 1009;
double ans, f[N][N];
int n, m, a[N];
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) f[i][j] = (a[i] > a[j]);
  for (int x, y, i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    f[x][y] = f[y][x] = .5;
    for (int j = 1; j <= n; ++j)
      if (j != x && j != y) {
        f[j][x] = f[j][y] = .5 * f[j][x] + .5 * f[j][y];
        f[x][j] = f[y][j] = 1 - f[j][x];
      }
  }
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) ans += f[i][j];
  printf("%.16f\n", ans);
}
