#include <bits/stdc++.h>
using namespace std;
double dp[1000 + 5][1000 + 5], ans = 0;
int a[1000 + 5], n, m;
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]) dp[i][j] = 1;
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    for (int j = 1; j <= n; j++)
      if (j != u && j != v)
        dp[u][j] = dp[v][j] = (dp[u][j] + dp[v][j]) / 2,
        dp[j][u] = dp[j][v] = (dp[j][u] + dp[j][v]) / 2;
    dp[u][v] = dp[v][u] = (dp[u][v] + dp[v][u]) / 2;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 1; j < i; j++) ans += dp[j][i];
  printf("%.10lf\n", ans);
  return 0;
}
