#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int n, m, a[maxn];
double dp[maxn][maxn], f[maxn][maxn];
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)++) dp[i][j] = a[i] > a[j];
  for (int(i) = (1); (i) <= (m); (i)++) {
    int x, y;
    scanf("%d%d", &x, &y);
    for (int(z) = (1); (z) <= (n); (z)++) {
      f[x][z] = dp[x][z];
      f[y][z] = dp[y][z];
    }
    for (int(z) = (1); (z) <= (n); (z)++) {
      if (z != x && z != y)
        dp[x][z] = dp[y][z] = 0.5 * (f[x][z] + f[y][z]);
      else
        dp[y][x] = dp[x][y] = 0.5 * (f[x][y] + f[y][x]);
      dp[z][x] = 1 - dp[x][z];
      dp[z][y] = 1 - dp[y][z];
    }
  }
  double ans = 0;
  for (int(i) = (1); (i) <= (n); (i)++)
    for (int(j) = (i + 1); (j) <= (n); (j)++) ans += dp[i][j];
  printf("%.10f\n", ans);
  return 0;
}
