#include <bits/stdc++.h>
using namespace std;
const int N = 1050;
long double pr[N][N];
int n, m, P[N];
inline long double gp(int i, int j) {
  if (i < j)
    return pr[i][j];
  else
    return 1 - pr[j][i];
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> P[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) pr[i][j] = P[i] > P[j];
  for (int i = 1, a, b; i <= m; ++i) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    for (int i = 1; i <= n; ++i)
      if (i != a && i != b) {
        pr[i][b] = pr[i][a] = (gp(i, a) + gp(i, b)) / 2;
        pr[b][i] = pr[a][i] = 1 - pr[i][a];
      }
    pr[a][b] = pr[b][a] = 0.5;
  }
  long double res = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) res += pr[i][j];
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}
