#include <bits/stdc++.h>
using namespace std;
const int MAX = 300005;
int n, cnt = 1, C[32 * MAX][2], type[32 * MAX], Free[32 * MAX];
char s[100];
vector<pair<int64_t, int> > rs;
void Add(int64_t val, int len, int sign) {
  int p = 1, tmp;
  for (int i = 31; i >= 32 - len; i--) {
    tmp = (val >> i) & 1;
    if (type[p] != sign && type[p] != 0) {
      cout << -1;
      exit(0);
    }
    if (sign == 1) Free[p] = 1;
    if (C[p][tmp] == 0) C[p][tmp] = ++cnt;
    p = C[p][tmp];
  }
  if (type[p] != sign && type[p] != 0) {
    cout << -1;
    exit(0);
  }
  if (sign == 1 && Free[p] == 0 && (C[p][0] != 0 || C[p][1] != 0)) {
    cout << -1;
    exit(0);
  }
  if (sign == -1 && Free[p] == 1 && (C[p][0] != 0 || C[p][1] != 0)) {
    cout << -1;
    exit(0);
  }
  if (sign == 1) Free[p] = 1;
  type[p] = sign;
}
void DFS(int pos, int64_t val, int high) {
  if (pos == 0) return;
  if (Free[pos] == 0) {
    rs.push_back(pair<int64_t, int>(val, 31 - high));
    return;
  }
  DFS(C[pos][0], val, high - 1);
  DFS(C[pos][1], val | (int64_t(1) << high), high - 1);
}
int main() {
  int sign, len, bit, a, b, c, d;
  int64_t val;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    len = strlen(s + 1);
    if (s[1] == '+')
      sign = 1;
    else
      sign = -1;
    sscanf(s + 2, "%d.%d.%d.%d", &a, &b, &c, &d);
    bit = 32;
    for (int i = 1; i <= len; i++)
      if (s[i] == '/') sscanf(s + i + 1, "%d", &bit);
    val = a;
    val = (val << 8) + b;
    val = (val << 8) + c;
    val = (val << 8) + d;
    Add(val, bit, sign);
  }
  DFS(1, 0, 31);
  cout << rs.size() << "\n";
  for (int i = 0; i < rs.size(); i++) {
    val = rs[i].first;
    d = val & 255;
    val >>= 8;
    c = val & 255;
    val >>= 8;
    b = val & 255;
    val >>= 8;
    a = val & 255;
    val >>= 8;
    bit = rs[i].second;
    printf("%d.%d.%d.%d/%d\n", a, b, c, d, bit);
  }
  return 0;
}
