#include <bits/stdc++.h>
using namespace std;
const int N = 1004;
int n, a[N], q;
double f[N][N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (a[i] < a[j])
        f[i][j] = 1;
      else if (a[i] > a[j])
        f[j][i] = 1;
  for (int i = 1; i <= q; ++i) {
    int x, y;
    cin >> x >> y;
    for (int j = 1; j <= n; ++j)
      if (j != x && j != y) {
        f[x][j] = f[y][j] = (f[x][j] + f[y][j]) / 2;
        f[j][x] = f[j][y] = (f[j][x] + f[j][y]) / 2;
      }
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) / 2;
  }
  double ans = 0;
  for (int i = 2; i <= n; ++i)
    for (int j = 1; j < i; ++j) ans += f[i][j];
  cout << setprecision(9) << ans << '\n';
  return 0;
}
