#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const int maxn = 3000;
int l[maxn + 5];
vector<int> e[maxn + 5];
double ans = 0;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0), _end_ = (n); i != _end_; ++i) {
    static int u, v;
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = (0), _end_ = (n); i != _end_; ++i) {
    static int dis[maxn + 5];
    memset(dis, oo, sizeof dis);
    static int q[(maxn << 1) + 5];
    static bool vis[maxn + 5];
    memset(vis, 0, sizeof vis);
    int tot = 0;
    dis[q[tot++] = i] = 0;
    for (int j = 0; j < tot; ++j) {
      const int &first = q[j];
      vis[first] = 0;
      for (int k = (0), _end_ = ((int((e[first]).size()))); k != _end_; ++k) {
        const int &second = e[first][k];
        if (dis[second] > dis[first] + 1 ? dis[second] = dis[first] + 1,
            1                            : 0) {
          if (!vis[second]) vis[q[tot++] = second] = 1;
        }
      }
    }
    for (int j = (0), _end_ = (n); j != _end_; ++j) ++l[dis[j] + 1];
  }
  for (int i = (1), _end_ = (n + 1); i != _end_; ++i) ans += 1.0 / i * l[i];
  printf("%.15lf\n", ans);
  return 0;
}
