#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, 0};
const long long INF = 1001001001001001LL;
const long long MOD = 1000000007LL;
long long int N, M, P[1010];
double dp[1010][1010];
signed main() {
  cin >> N >> M;
  for (long long int(i) = (0); (i) < (N); (i)++) cin >> P[i];
  for (long long int(i) = (0); (i) < (N); (i)++)
    for (long long int(j) = (0); (j) < (N); (j)++) {
      dp[i][j] = (P[i] > P[j]);
    }
  while (M--) {
    long long int a, b;
    cin >> a >> b;
    a--;
    b--;
    dp[a][b] = dp[b][a] = 0.5;
    for (long long int(i) = (0); (i) < (N); (i)++) {
      if (i == a || i == b) continue;
      dp[i][a] = dp[i][b] = (dp[i][a] + dp[i][b]) / 2.0;
      dp[a][i] = dp[b][i] = (dp[a][i] + dp[b][i]) / 2.0;
    }
  }
  double ans = 0.0;
  for (long long int(i) = (0); (i) < (N); (i)++)
    for (long long int(j) = (i + 1); (j) < (N); (j)++) ans += dp[i][j];
  printf("%.12f\n", ans);
  return 0;
}
