#include <bits/stdc++.h>
using namespace std;
long double dp[1005][1005];
int p[1005];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (p[i] > p[j]) dp[i][j] = 1;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    dp[x][y] = 0.5;
    dp[y][x] = 0.5;
    for (int j = 0; j < n; j++)
      if (j != x && j != y) {
        dp[j][y] = (dp[j][x] + dp[j][y]) / 2.0;
        dp[j][x] = dp[j][y];
        dp[y][j] = 1.0 - dp[j][y];
        dp[x][j] = dp[y][j];
      }
  }
  long double ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) ans += dp[i][j];
  cout << fixed << setprecision(10) << ans;
}
