#include <bits/stdc++.h>
using namespace std;
int ch[10000100][2];
int flag[10000100], sum[10000100];
int cur = 1;
void add(int u, long long L, long long R, long long l, long long r, int fl) {
  long long mid = L + R >> 1;
  if (flag[u] & (1 << !fl)) {
    puts("-1");
    exit(0);
  }
  if (l <= L && R <= r) {
    if (sum[u] & (1 << !fl)) {
      puts("-1");
      exit(0);
    }
    flag[u] = sum[u] = 1 << fl;
    return;
  }
  if (l < mid) {
    if (!ch[u][0]) ch[u][0] = ++cur;
    add(ch[u][0], L, mid, l, r, fl);
  } else {
    if (!ch[u][1]) ch[u][1] = ++cur;
    add(ch[u][1], mid, R, l, r, fl);
  }
  sum[u] = flag[u] | sum[ch[u][0]] | sum[ch[u][1]];
}
vector<pair<long long, int> > ans;
void solve(int u, long long L, long long R) {
  if (sum[u] <= 1) return;
  if (sum[u] == 2) {
    ans.push_back(pair<long long, int>(L, __builtin_ctzll(R - L)));
    return;
  }
  if (ch[u][0]) solve(ch[u][0], L, L + R >> 1);
  if (ch[u][1]) solve(ch[u][1], L + R >> 1, R);
}
int main() {
  int n;
  cin >> n;
  char s[111];
  long long mx = 1LL << 32;
  while (n--) {
    scanf("%s", s);
    int flag = s[0] == '-';
    char *t = strtok(s + 1, "./");
    int a[5], cnt = 0;
    while (t) {
      a[cnt++] = atoi(t);
      t = strtok(NULL, "./");
    }
    long long first = 0;
    for (int i = 0; i < 4; i++) first = first << 8 | a[i];
    if (cnt == 4)
      add(1, 0, mx, first, first + 1, flag);
    else
      add(1, 0, mx, first, first + (1LL << 32 - a[4]), flag);
  }
  solve(1, 0, mx);
  cout << ans.size() << endl;
  for (pair<long long, int> p : ans) {
    int a[4];
    long long first = p.first;
    for (int i = 4; i--;) a[i] = first & 255, first >>= 8;
    printf("%d.%d.%d.%d/%d\n", a[0], a[1], a[2], a[3], 32 - p.second);
  }
  return 0;
}
