#include <bits/stdc++.h>
using namespace std;
double dp[1010][1010];
int n;
int v[1010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i(1); i <= n; i++) cin >> v[i];
  for (int i(1); i <= n; i++)
    for (int j(1); j <= n; j++) dp[i][j] = (v[i] > v[j] ? 1 : 0);
  while (m--) {
    int x, y;
    cin >> x >> y;
    for (int i(1); i <= n; i++) {
      if (i == x || i == y) continue;
      dp[i][x] = dp[i][y] = (dp[i][x] + dp[i][y]) / 2;
      dp[x][i] = dp[y][i] = (dp[x][i] + dp[y][i]) / 2;
    }
    dp[x][y] = dp[y][x] = 1.0 / 2;
  }
  double ans(0);
  for (int i(1); i <= n; i++)
    for (int j(i + 1); j <= n; j++) ans += dp[i][j];
  cout << setprecision(9) << ans << '\n';
  return 0;
}
