#include <bits/stdc++.h>
int a, b, i, j, c, cnt, ch;
long long o, u;
struct B {
  long long n;
  int d;
} ans[200006];
struct D {
  long long oo;
  long long uu;
  int cc;
} data[200006];
long long sz;
char s[1111];
struct A {
  bool isb;
  bool isw;
};
std::map<long long, A> seg;
void update(long long num, long long st, long long en, long long x, long long h,
            int col) {
  if (col == 1) seg[num].isb = 1;
  if (col == 0) seg[num].isw = 1;
  if (h == 0) {
    if (col == 1 && seg[num].isw == 1) ch = 1;
    if (col == 0 && seg[num].isb == 1) ch = 1;
    return;
  }
  if (x <= (st + en) / 2)
    update(num * 2, st, (st + en) / 2, x, h - 1, col);
  else
    update(num * 2 + 1, (st + en) / 2 + 1, en, x, h - 1, col);
}
void sol(long long num, long long st, long long en, int h) {
  if (seg[num].isb == 0) return;
  if (seg[num].isw == 0) {
    ans[sz++] = {st, h};
  } else {
    sol(num * 2, st, (st + en) / 2, h + 1);
    sol(num * 2 + 1, (st + en) / 2 + 1, en, h + 1);
  }
}
int main() {
  scanf("%d", &a);
  for (i = 0; i < a; i++) {
    scanf("%s", s);
    b = strlen(s);
    if (s[0] == '-') {
      c = 1;
    } else
      c = 0;
    o = 0;
    u = 0;
    cnt = 0;
    for (j = 1; j < b && s[j] != '/'; j++) {
      if (s[j] == '.') {
        if (cnt == 0) o += u * (1ll << 24);
        if (cnt == 1) o += u * (1ll << 16);
        if (cnt == 2) o += u * (1ll << 8);
        cnt++;
        u = 0;
      } else
        u = u * 10 + (s[j] - '0');
    }
    o += u;
    if (j < b) {
      j++;
      u = 0;
      for (; j < b; j++) {
        u = u * 10 + (s[j] - '0');
      }
    } else
      u = 32;
    data[i] = {o, u, c};
    update(1, 0, (1ll << 32) - 1, data[i].oo, data[i].uu, data[i].cc);
  }
  for (int i = 0; i < a; i++)
    update(1, 0, (1ll << 32) - 1, data[i].oo, data[i].uu, data[i].cc);
  if (ch == 1) {
    puts("-1");
    return 0;
  }
  sol(1, 0, (1ll << 32) - 1, 0);
  printf("%lld\n", sz);
  for (i = 0; i < sz; i++) {
    printf("%lld.%lld.%lld.%lld/%d\n", ans[i].n / (1 << 24),
           ans[i].n % (1 << 24) / (1 << 16), ans[i].n % (1 << 16) / (1 << 8),
           ans[i].n % (1 << 8), ans[i].d);
  }
}
